• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Balance Theme: display featured left & right widgets sitewide

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

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

This topic is: not resolved

Tagged: Balance, functions.php, widgets

  • This topic has 17 replies, 6 voices, and was last updated 10 years ago by Marco.
Viewing 18 posts - 1 through 18 (of 18 total)
  • Author
    Posts
  • January 21, 2013 at 4:35 pm #13581
    Frank
    Member

    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 #13944
    SoZo
    Member

    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

    January 24, 2013 at 1:12 am #14254
    Frank
    Member

    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

    January 24, 2013 at 1:15 am #14256
    Frank
    Member

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

    Regards

    January 24, 2013 at 10:46 am #14323
    SoZo
    Member

    You 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 #14334
    Frank
    Member

    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?

    January 24, 2013 at 11:39 am #14341
    Frank
    Member

    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?

    January 24, 2013 at 12:53 pm #14364
    SoZo
    Member

    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

    January 24, 2013 at 1:53 pm #14381
    Frank
    Member

    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!

    January 25, 2013 at 7:12 pm #14923
    Frank
    Member

    Hello anybody?

    Any help will be greatly appreciated

    January 29, 2013 at 8:34 am #15959
    cdils
    Participant

    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 host a weekly WordPress-focused podcast called Office Hours. I tweet @cdils.

    January 29, 2013 at 8:36 am #15960
    surefirewebserv
    Member

    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

    January 29, 2013 at 9:14 am #15969
    Marco
    Member

    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?


    Neat & Plain – Genesis and WordPress specialist

    January 29, 2013 at 9:20 am #15970
    David Decker
    Member

    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 ๐Ÿ™‚


    Twitter @deckerweb // Google+ // My Genesis & WordPress Plugins // German Translations for Genesis

    January 29, 2013 at 11:07 am #16014
    Frank
    Member

    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

    January 29, 2013 at 2:24 pm #16092
    Marco
    Member

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


    Neat & Plain – Genesis and WordPress specialist

    January 30, 2013 at 12:36 am #16336
    Frank
    Member

    Neat & Plain indeed! That was the problem, and now it is solved.

    Thanks a lot Marco ๐Ÿ™‚

    January 30, 2013 at 1:03 pm #16447
    Marco
    Member

    You're welcome. Glad it's solved.


    Neat & Plain – Genesis and WordPress specialist

  • Author
    Posts
Viewing 18 posts - 1 through 18 (of 18 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble