Prose theme – trouble adding custom widget

Community Forums Forums Design Tips and Tricks Prose theme – trouble adding custom widget

This topic is: not resolved

This topic contains 4 replies, has 3 voices, and was last updated by  David Chu 1 year, 4 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #44234

    swingbox
    Participant
    Post count: 1

    Hi, I would like to add some text below the header and above the content area so I decided to add a custom widget area. In the function.php file, I have added the following code:

    genesis_register_sidebar( array(

    ‘id’        => ‘before-content-ad’,

    ‘name’      => ‘Before Content Ad’,

    ‘description’   => ‘This is a sidebar that goes before the content.’,

    ) );

    add_action( ‘genesis_before_content_sidebar_wrap’, ‘child_before_content_ad_sidebar’ );

    /** Loads a new sidebar before the content */

    function child_before_content_ad_sidebar() {

    echo ‘<div class=”before-content-ad”>’;

    dynamic_sidebar( ‘before-content-ad’ );

    echo ‘</div>’;

    }

    I expect to see a new custom widget area on dashboard but there is none .  What did I do wrong? I am very new to wordpress so please point me to the right direction.

    Thanks

    #44237

    David Chu
    Participant
    Post count: 1371

    Hi,
    Your code looks good to me, at least at a glance. My best guess would be that your single quotes are not the right kind. I would try using the straight up-and-down ones. Yours are listing to starboard, so to speak. :-) Same deal with the double-quotes.

    Dave


    Dave Chu · Custom WordPress Developer – likes collaborating with Designers

    #44273

    braddalton
    Participant
    Post count: 10217

    You need to add the code to your init.php file.

    Copy the code from the view raw link and paste it at the end of the file using a text editor like Notepad ++

    Code not displaying? Grab it on Github.

    You can also change the hook position if needed.


    #44360

    swingbox
    Participant
    Post count: 1

    Thank you Brad and Dave! I is working perfectly. A lot of tutorial points me to adding the code to functions.php but Prose theme seems to handle things differently.

    Thanks again wordpress community!

    Wilfred

    #44362

    David Chu
    Participant
    Post count: 1371

    Wilfred,
    You’re welcome. Functions.php is the normal way in Studiopress and regular WordPress themes. You can also add it via your own home-brewed function file.

    But it is true, Prose has a lot of custom code that’s different from other Studiopress themes. I’ve wrestled with it a number of times – it’s a real oddball, but has some cool functionality.

    Dave


    Dave Chu · Custom WordPress Developer – likes collaborating with Designers

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.