Community Forums › Forums › Design Tips and Tricks › Balance Theme: display featured left & right widgets sitewide
Tagged: Balance, functions.php, widgets
This topic contains 17 replies, has 6 voices, and was last updated by Marco 3 months, 3 weeks ago.
-
AuthorPosts
-
January 21, 2013 at 4:35 pm #13581
Hi,
After looking at my functions.php file, I couldn’t find how to tell WP to display the “Featured Right/Left” widgets sitewide and would greatly appreciate if you can tell me how and where to do this.
Thanks a lot in advance!
January 22, 2013 at 7:10 pm #13944That function is in home.php. You’d need to move it to functions.php
John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography
January 24, 2013 at 1:12 am #14254Thanks Sozo,
I’m using front-page.php instead and I can’t get the code to work yet. Can you please tell me what to change in here to have both widgets to appear sitewide?
This is the current code:
<?phpadd_action( 'genesis_meta', 'balance_home_genesis_meta' );
/**
* Add widget support for homepage.
*
*/
function balance_home_genesis_meta() {if ( is_active_sidebar( 'home-featured-left' ) || is_active_sidebar( 'home-featured-right' ) ) {
add_action( 'genesis_after_header', 'balance_home_loop_helper' );
}
}/**
* Display widget content for home featured sections.
*
*/
function balance_home_loop_helper() {if ( is_active_sidebar( 'home-featured-left' ) || is_active_sidebar( 'home-featured-right' ) ) {
echo '';
echo '';
dynamic_sidebar( 'home-featured-left' );
echo '';echo '';
dynamic_sidebar( 'home-featured-right' );
echo '';echo '';
}
}
genesis();
Regards
January 24, 2013 at 1:15 am #14256This may be easier to read: http://pastie.org/private/vefkvflxxxrxwfym1z3ja
Regards
January 24, 2013 at 10:46 am #14323You have to move the code into functions.php.
John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography
January 24, 2013 at 11:02 am #14334Understood. I tried to paste the code in my functions.php file but a syntax error appeared, as I don’t really know the language.
Can you tell me what the code should look like following this new page:
http://pastie.org/private/vqblajaqfafxj3rl8e6k0g
I pasted exactly like this and the error appeared.
1. What do I need to change to this code to work?
2. Will this code make both widgets to appear in the entire site?January 24, 2013 at 11:39 am #14341After looking at the original code, but trying to display it in the entire site, I came with this code
…but it is causing a Error 500 (Internal Server Error).
I know my syntax is wrong, although I can’t tell where/why.
Can you check it out and help me correct it?
January 24, 2013 at 12:53 pm #14364You’re missing a closing curly brace at the end and you don’t really need these conditionals
&& ( is_singular() || is_page() || is_archive() ) )
John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography
January 24, 2013 at 1:53 pm #14381Nope! Still having problems here.
I’ve deleted the conditionals, added the closing curly brace and also corrected the hook where I want the widget to appear, but when pasting it to my functions.php file, it still causes the same 500 Error.
This is the latest code…
Thanks for all your help!
January 25, 2013 at 7:12 pm #14923Hello anybody?
Any help will be greatly appreciated
January 29, 2013 at 8:34 am #15959Hi there,
Re-do your single and double quotes – looks like they are stylized and not plain.

Have you been helped in this forum? Pay it forward and answer someone else’s question. I bet you’ll know the answer to at least one question.
I tweet @cdils.
January 29, 2013 at 8:36 am #15960500 error usually means that some syntax is wrong. Check the rest of the code and make sure you have everything ending correctly etc. Ending ; and no missing commas, etc.
SureFireWebServices.com | Genesis Tuts and More
Genesis Theme Starter Kit | It’s FreeJanuary 29, 2013 at 9:14 am #15969I have just copied/pasted the code on http://pastie.org/5850228 at the very end of my functions.php file and it looks good.
Maybe there’s something wrong somewhere else on the functions.php or on the front-page.php.
Could you paste the content of those files?
January 29, 2013 at 9:20 am #15970I also took the code from http://pastie.org/5850228 into a “Balance” test install and placed at the bottom of functions.php and it was working immediately!
Logically all is ok with the code, so there could be something other in your install beside the syntax that is conflicting? Maybe you have other code snippets that hook in via the hook “genesis_after_content”?
Hope this helps, Dave

January 29, 2013 at 11:07 am #16014Hello and thanks a lot everyone
@ cdils – commas are ok, but thanks; @ David – That’s the only hook to genesis_after_content but thanks for pointing that out. Please look at the entire file to see if you can spot something else…
@ surefirewebserv, @ Marco – Yep, I also believe the problem is in the syntax elsewhere in the functions.php file, so as you suggest Marco, I’m copying the code in here: http://pastie.org/5940942
Thanks again
-
AuthorPosts
You must be logged in to reply to this topic.