kwmlr439 Posted May 9, 2014 Share Posted May 9, 2014 (edited) PHP Warriors, Please help I am trying to write a function in the genesis framwork that would allow me to add before_content_sidebar_wrap only on page_blog.php for my slider but can't seem to get it to work! I notice that the wrap and hook are added successefully but they display in every page instead of the blog only. Any help would be greatly appreciated. Here is my function add_action('genesis_before_content_sidebar_wrap', 'child_before_content_sidebar_wrap'); if ( ! ( is_page_template( ‚page_blog.php‚ ) ) ) return; and here is my website I am displaying the slider on. It should be only on the blog page; mainlinerealtors.com/blog/Thanks a lot, Edited May 9, 2014 by kwmlr439 Quote Link to comment https://forums.phpfreaks.com/topic/288365-php-function/ Share on other sites More sharing options...
Clarkey Posted May 9, 2014 Share Posted May 9, 2014 Try adding the if statement around the add_action function. I have never used the genesis framework so this is just a pure stab in the dark. By the way, the syntax looks weird in your if statement!? if(is_page_template( ,page_blog.php, ) { add_action('genesis_before_content_sidebar_wrap', 'child_before_content_sidebar_wrap'); } Quote Link to comment https://forums.phpfreaks.com/topic/288365-php-function/#findComment-1478862 Share on other sites More sharing options...
kwmlr439 Posted May 9, 2014 Author Share Posted May 9, 2014 Try adding the if statement around the add_action function. I have never used the genesis framework so this is just a pure stab in the dark. By the way, the syntax looks weird in your if statement!? if(is_page_template( ,page_blog.php, ) { add_action('genesis_before_content_sidebar_wrap', 'child_before_content_sidebar_wrap'); } Clarkey,Thanks for your reply; I just tried to add add the if statement before the functions but didn't work; it just went blank Quote Link to comment https://forums.phpfreaks.com/topic/288365-php-function/#findComment-1478864 Share on other sites More sharing options...
QuickOldCar Posted May 21, 2014 Share Posted May 21, 2014 if (is_page_template('page_blog.php') ) { add_action('genesis_before_content_sidebar_wrap', 'child_before_content_sidebar_wrap'); } Quote Link to comment https://forums.phpfreaks.com/topic/288365-php-function/#findComment-1480254 Share on other sites More sharing options...
QuickOldCar Posted May 21, 2014 Share Posted May 21, 2014 (edited) Clarkey, on 09 May 2014 - 08:24 AM, said: I have never used the genesis framework so this is just a pure stab in the dark. genesis framework is just a way to create wordpress themes, in the end is all the same wordpress code. Edited May 21, 2014 by QuickOldCar Quote Link to comment https://forums.phpfreaks.com/topic/288365-php-function/#findComment-1480255 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.