homepage Welcome to WebmasterWorld Guest from 50.16.130.188
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
getting a variable from a function
surrealillusions




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

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?

 

coopster




msg:4537778
 9:15 pm on Jan 20, 2013 (gmt 0)

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?

surrealillusions




msg:4537802
 9:56 pm on Jan 20, 2013 (gmt 0)

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.

coopster




msg:4537810
 10:57 pm on Jan 20, 2013 (gmt 0)

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 :)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved