Community Forums › Forums › Archived Forums › Design Tips and Tricks › Balance Theme: display featured left & right widgets sitewide
Tagged: Balance, functions.php, widgets
- This topic has 17 replies, 6 voices, and was last updated 10 years ago by
Marco.
-
AuthorPosts
-
January 21, 2013 at 4:35 pm #13581
Frank
MemberHi,
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 #13944SoZo
MemberThat 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 #14254Frank
MemberThanks 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 #14256Frank
MemberThis may be easier to read: http://pastie.org/private/vefkvflxxxrxwfym1z3ja
Regards
January 24, 2013 at 10:46 am #14323SoZo
MemberYou 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 #14334Frank
MemberUnderstood. 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/vqblajaqfafxj3rl8e6k0gI 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 #14341Frank
MemberAfter looking at the original code, but trying to display it in the entire site, I came with this code
http://pastie.org/5849119
...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 #14364SoZo
MemberYou'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 #14381Frank
MemberNope! 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...
http://pastie.org/5850228Thanks for all your help!
January 25, 2013 at 7:12 pm #14923Frank
MemberHello anybody?
Any help will be greatly appreciated
January 29, 2013 at 8:34 am #15959cdils
ParticipantHi 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 host a weekly WordPress-focused podcast called Office Hours. I tweet @cdils.
January 29, 2013 at 8:36 am #15960surefirewebserv
Member500 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 #15969Marco
MemberI 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 #15970David Decker
MemberI 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 #16014Frank
MemberHello 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
January 29, 2013 at 2:24 pm #16092Marco
MemberLooks like you're already using balance_include_text
add_action('genesis_after_post_content', 'balance_include_text', 1);
you cannot use the same name for the action if they do different things:
add_action('genesis_after_header', 'balance_include_text', 1);
Change one balance_include_text to something else.
January 30, 2013 at 12:36 am #16336Frank
MemberNeat & Plain indeed! That was the problem, and now it is solved.
Thanks a lot Marco ๐
January 30, 2013 at 1:03 pm #16447Marco
Member -
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.