Welcome to WebmasterWorld Guest from 54.161.147.106

Forum Moderators: coopster & jatar k

getting a variable from a function

   
11:53 am on Aug 23, 2012 (gmt 0)

5+ Year Member



Need some help here in getting a variable from a function.

Inside the functions.php file, there is a bunch of URL rewrite stuff inside an array for this Wordpress theme, and I need to create a page id based on the pages to be used in another part of the theme.

For example:


'all-blog-posts/?$' => 'index.php?special_page=blog&my_custom_page_type=all-blog-posts&paged=1',
'all-blog-posts/page/?([0-9]{1,})/?$' => 'index.php?special_page=blog&my_custom_page_type=all-blog-posts&paged='.$wp_rewrite->preg_index(1),


That is a part of the array, containing 2 array thingymigigs (whatever the official name is).

And after that array, there is this line. The array is called $new_rules
The function is called

function websiteTheme_rewrite_rules( $wp_rewrite )
{

$wp_rewrite->rules = $new_rules + $wp_rewrite->rules;

How do I give that all-blog-posts a page id, of the same name for example?
9:15 pm on Jan 20, 2013 (gmt 0)

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



I read this a few times trying to wrap my head around the question. I don't understand how you can use $new_rules in that function when it has not yet been declared?
9:56 pm on Jan 20, 2013 (gmt 0)

5+ Year Member



A blast from the not quite so far reaching past but still a few months ago...I cant even remember what I was asking about now, dont think even I get what I was asking either :)

Fair to say that whatever it was, I either found a solution to this or gave up and found something else.
10:57 pm on Jan 20, 2013 (gmt 0)

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



You are correct, I was trying to go through and catch orphan threads today as I had a few minutes this afternoon. Just wanted to see if you were still tangling with this one, surrealillusions :)
 

Featured Threads

Hot Threads This Week

Hot Threads This Month