ThemeShaper Forums » Thematic

[closed]

Custom widget area shows in sidebar but not on live site

(9 posts)
  • Started 3 years ago by jaymp
  • Latest reply from helgatheviking
  • This topic is not resolved
  1. jaymp
    Member

    I'm trying to add a widget ready area to the belowfooter action hook. This is my code:

    <?php

    //register bucket area
    function bucket_bar( ) {
    register_sidebar (array (
    'name' => 'Bucket Bar',
    'id' => 'bucket-bar',
    'description' => __( 'A widget area between the footer and the content', 'thematic'),
    'before_widget' => thematic_before_widget( ) ,
    'after_widget' => thematic_after_widget( ) ,
    'before_title' => thematic_before_title( ) ,
    'after_title' => thematic_after_title( ) )
    ) ;
    }

    add_action('init', 'bucket_bar') ;

    //add bucket widget area
    function add_bucket_bar( ) {
    if (is_sidebar_active('bucket-bar')) {
    echo thematic_before_widget_area(dynamic_sidebar('bucket-bar'));
    dynamic_sidebar('bucket-bar');
    echo thematic_after_widget_area('bucket-bar');
    }
    }

    add_action('thematic_abovefooter', 'add_bucket-bar', 10);
    ?>

    The widget area registers, and shows in my dashboard, but will not show on the live site when I place widgets into it.

    Criticism and suggestion heavily appreciated.

    Posted 3 years ago #
  2. did you resolve this? can't think of a reason this wouldn't work.. except maybe funny CSS. does the widget show up in the markup (ie if you View Source) ?

    link?

    Posted 3 years ago #
  3. jaymp
    Member

    Thanks for looking at it. I've been busy on other parts of the customization, so it's still not resolved. At first I thought it was CSS, but it doesn't show in the source code at all. I did do this:

    //add test content for above footer hook
    function test_above_footer () {
    {?>

    <h1>This is a test </h1>

    <?php } }
    add_action('thematic_abovefooter','test_above_footer');

    Which shows up properly. I don't know. I'm a bit lost here.

    Posted 3 years ago #
  4. middlesister
    Member

    In thematic_before_widget_area, shouldn't it be
    echo thematic_before_widget_area('bucket-bar');
    instead of
    echo thematic_before_widget_area(dynamic_sidebar('bucket-bar')); ?

    Posted 3 years ago #
  5. threw it into a local install and you've got 2 problems. i'm actually surprised this worked locally for you, b/c i got error messages straight away.

    first, a typo in the add_action. you are trying to add add_bucket-bar when you've defined add_bucket_bar.

    second,

    echo thematic_before_widget_area(dynamic_sidebar('bucket-bar'));

    was causing it to print out the dynamic_sidebar a second time.

    try this:

    //add bucket widget area
    function add_bucket_bar( ) {
    if (is_sidebar_active('bucket-bar')) {
    echo thematic_before_widget_area('bucket-bar');
    dynamic_sidebar('bucket-bar');
    echo thematic_after_widget_area('bucket-bar');
    }
    }
    
    add_action('thematic_abovefooter', 'add_bucket_bar', 10);

    also live sites tend to suppress error messages and error messages can be key to solving problems.

    i really like
    http://www.wprecipes.com/how-to-easily-enabledisable-debug-mode-in-wordpress

    for easier debugging. can't fix what you don't know is broke.

    Posted 3 years ago #
  6. middlesister
    Member

    Yeah, enabling debug is a good thing. A useful plugin is http://wordpress.org/extend/plugins/debug-bar/, it will add a debug menu to your admin bar. Very handy.

    Posted 3 years ago #
  7. jaymp
    Member

    Awesome. Thank you both a million.

    Posted 3 years ago #
  8. if that solved it don't forget to mark as resolved. cheers

    Posted 3 years ago #
  9. if that solved it don't forget to mark as resolved. cheers

    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.