Balance Theme: display featured left & right widgets sitewide

Community Forums Forums Design Tips and Tricks Balance Theme: display featured left & right widgets sitewide

This topic is: not resolved

This topic contains 17 replies, has 6 voices, and was last updated by  Marco 1 year, 5 months ago.

Viewing 15 posts - 1 through 15 (of 18 total)
  • Author
    Posts
  • #13581

    fsco
    Participant
    Post count: 11

    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!

    #13944

    SoZo
    Moderator
    Post count: 1573

    That function is in home.php. You’d need to move it to functions.php


    John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography

    #14254

    fsco
    Participant
    Post count: 11

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


    <?php

    add_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

    #14256

    fsco
    Participant
    Post count: 11

    This may be easier to read: http://pastie.org/private/vefkvflxxxrxwfym1z3ja

    Regards

    #14323

    SoZo
    Moderator
    Post count: 1573

    You have to move the code into functions.php.


    John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography

    #14334

    fsco
    Participant
    Post count: 11

    Understood. 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?

    #14341

    fsco
    Participant
    Post count: 11

    After 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?

    #14364

    SoZo
    Moderator
    Post count: 1573

    You’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

    #14381

    fsco
    Participant
    Post count: 11

    Nope! 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/5850228

    Thanks for all your help!

    #14923

    fsco
    Participant
    Post count: 11

    Hello anybody?

    Any help will be greatly appreciated

    #15959

    cdils
    Participant
    Post count: 420

    Hi 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.

    #15960

    surefirewebserv
    Participant
    Post count: 68

    500 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 Free

    #15969

    Marco
    Participant
    Post count: 63

    I 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?


    #15970

    David Decker
    Moderator
    Post count: 93

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


    #16014

    fsco
    Participant
    Post count: 11

    Hello 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

Viewing 15 posts - 1 through 15 (of 18 total)

You must be logged in to reply to this topic.