WordPress widgets not displaying on custom theme

I built a custom wordpress theme, and I also built a custom widget sidebar (so widgets are enabled), I can see the title of the widget, but the content is not showing. For example I’m using a poll widget, the title is exactly as I’ve set it, but the content is completely blank.

In the header the scripts for the plugin are loaded, but again there is no content. I tried multiple plugins, and they all do the same thing. I also attempted this with using do_shortcode() and again, no content. So I am stumped.

Read More

I have also tried getting support on the wordpress forum, but I’ve never successfully gotten an answer to my query there.

My hope is that someone has had this same issue, and can point me to what the problem may be.

In the header, i’ve included the following information:

<html <?php language_attributes(); ?>>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<?php wp_head();?>
<?php wp_meta();?>
<?php wp_print_scripts();?>

However again, no results. Google searches have also not pulled up anything about this being an issue. Here’s the odd thing, I design all wordpress themes the same way, most of which are all hosted on the same server, and this is the only theme having this problem.

Also I’ve included my functions.php script for reference purposes.

<?php
function twentyten_widgets_init() {

    register_sidebar( array(
        'name' => __( 'Primary Widget Area', 'twentyten' ),
        'id' => 'primary-widget-area',
        'description' => __( 'Add widgets here to appear in your sidebar.', 'twentyten' ),
        'before_widget' => '<div id="spacer">',
        'after_widget' => '</div></div>',
        'before_title' => '<div id="left_top">',
        'after_title' => '</div><div id="left_bottom">',
    ) );
}

add_action( 'widgets_init', 'twentyten_widgets_init' );

add_filter( 'show_admin_bar', '__return_false' );

remove_action( 'personal_options', '_admin_bar_preferences' );
?>

EDIT **
I removed from the header as it was causing duplicate scripts in the header. So that is no longer an issue, however that did not resolve the issue and nothing has changed as a result of being removed.

Related posts

Leave a Reply

1 comment

  1. From your code all your widget will look like:

     <div id="spacer">
     <div id="left_top">Title</div>
     <div id="left_bottom">
     CONTENT
     </div></div>
    

    You are using id’s here (maybe you intend to use classes) here for your elements, like id="left_top". So adding more than one widget will give you a problem, see Can multiple different HTML elements have the same ID if they’re different elements?, cause the id’s should be unique.

    You will maybe apply a css / javascript on one of these id’s like
    #left_bottom{display:none} this will explain why your content will be not shown independent of the widget you use.