Support » Code oplossingen gezocht » Widget area inactief?

  • Voor de WordPress die ik onderhoud wil ik gebruik maken van Widgets. Nu heeft mijn theme wel Widgets, maar die lijken inactive. Als ik er een widget inschuif is deze niet terug te zien op de website.

    Een oplossing kan zijn om een ander theme te gebruiken, maar ik wil graag dit theme blijven gebruiken. Naar mijn idee staat er fout in de php, maar ik krijg het niet voor elkaar om dit probleem op te lossen. Is er iemand die mijn kan helpen aan een oplossing?

    Hieronder staat een deel van de theme.php wat over widgets gaat en de sidebar.php.

    Theme.php

    /**
    * Register widgetized areas, including two sidebars and four widget-ready columns in the footer.
    *
    * To override twentyten_widgets_init() in a child theme, remove the action hook and add your own
    * function tied to the init hook.
    *
    * @since Twenty Ten 1.0
    * @uses register_sidebar
    */
    function twentyten_widgets_init() {
    // Area 1, located at the top of the sidebar.
    register_sidebar( array(
    ‘name’ => __( ‘Primary Widget Area’, ‘twentyten’ ),
    ‘id’ => ‘primary-widget-area’,
    ‘description’ => __( ‘The primary widget area’, ‘twentyten’ ),
    ‘before_widget’ => ‘<li id=”%1$s” class=”widget-container %2$s”>’,
    ‘after_widget’ => ”,
    ‘before_title’ => ‘<h3 class=”widget-title”>’,
    ‘after_title’ => ‘</h3>’,
    ) );

    // Area 2, located below the Primary Widget Area in the sidebar. Empty by default.
    register_sidebar( array(
    ‘name’ => __( ‘Secondary Widget Area’, ‘twentyten’ ),
    ‘id’ => ‘secondary-widget-area’,
    ‘description’ => __( ‘The secondary widget area’, ‘twentyten’ ),
    ‘before_widget’ => ‘<li id=”%1$s” class=”widget-container %2$s”>’,
    ‘after_widget’ => ”,
    ‘before_title’ => ‘<h3 class=”widget-title”>’,
    ‘after_title’ => ‘</h3>’,
    ) );

    // Area 3, located in the footer. Empty by default.
    register_sidebar( array(
    ‘name’ => __( ‘First Footer Widget Area’, ‘twentyten’ ),
    ‘id’ => ‘first-footer-widget-area’,
    ‘description’ => __( ‘The first footer widget area’, ‘twentyten’ ),
    ‘before_widget’ => ‘<li id=”%1$s” class=”widget-container %2$s”>’,
    ‘after_widget’ => ”,
    ‘before_title’ => ‘<h3 class=”widget-title”>’,
    ‘after_title’ => ‘</h3>’,
    ) );

    // Area 4, located in the footer. Empty by default.
    register_sidebar( array(
    ‘name’ => __( ‘Second Footer Widget Area’, ‘twentyten’ ),
    ‘id’ => ‘second-footer-widget-area’,
    ‘description’ => __( ‘The second footer widget area’, ‘twentyten’ ),
    ‘before_widget’ => ‘<li id=”%1$s” class=”widget-container %2$s”>’,
    ‘after_widget’ => ”,
    ‘before_title’ => ‘<h3 class=”widget-title”>’,
    ‘after_title’ => ‘</h3>’,
    ) );

    // Area 5, located in the footer. Empty by default.
    register_sidebar( array(
    ‘name’ => __( ‘Third Footer Widget Area’, ‘twentyten’ ),
    ‘id’ => ‘third-footer-widget-area’,
    ‘description’ => __( ‘The third footer widget area’, ‘twentyten’ ),
    ‘before_widget’ => ‘<li id=”%1$s” class=”widget-container %2$s”>’,
    ‘after_widget’ => ”,
    ‘before_title’ => ‘<h3 class=”widget-title”>’,
    ‘after_title’ => ‘</h3>’,
    ) );

    // Area 6, located in the footer. Empty by default.
    register_sidebar( array(
    ‘name’ => __( ‘Fourth Footer Widget Area’, ‘twentyten’ ),
    ‘id’ => ‘fourth-footer-widget-area’,
    ‘description’ => __( ‘The fourth footer widget area’, ‘twentyten’ ),
    ‘before_widget’ => ‘<li id=”%1$s” class=”widget-container %2$s”>’,
    ‘after_widget’ => ”,
    ‘before_title’ => ‘<h3 class=”widget-title”>’,
    ‘after_title’ => ‘</h3>’,
    ) );
    }
    /** Register sidebars by running twentyten_widgets_init() on the widgets_init hook. */
    add_action( ‘widgets_init’, ‘twentyten_widgets_init’ );

    /**
    * Removes the default styles that are packaged with the Recent Comments widget.
    *
    * To override this in a child theme, remove the filter and optionally add your own
    * function tied to the widgets_init action hook.

    sidebar.php>

    <?php
    /**
    * The Sidebar containing the primary and secondary widget areas.
    *
    * @package WordPress
    * @subpackage Starkers
    * @since Starkers 3.0
    */
    ?>

    <ul class=”xoxo”>

    <?php
    /* When we call the dynamic_sidebar() function, it’ll spit out
    * the widgets for that widget area. If it instead returns false,
    * then the sidebar simply doesn’t exist, so we’ll hard-code in
    * some default sidebar stuff just in case.
    */
    if ( ! dynamic_sidebar( ‘primary-widget-area’ ) ) : ?>

    • <?php get_search_form(); ?>
    • <h3><?php _e( ‘Archives’, ‘twentyten’ ); ?></h3>
      <?php wp_get_archives( ‘type=monthly’ ); ?>
    • <h3><?php _e( ‘Meta’, ‘twentyten’ ); ?></h3>
      <?php wp_register(); ?>

    • <?php wp_loginout(); ?>
    • <?php wp_meta(); ?>

    <?php endif; // end primary widget area ?>

    <?php
    // A second sidebar for widgets, just because.
    if ( is_active_sidebar( ‘secondary-widget-area’ ) ) : ?>

    <ul class=”xoxo”>
    <?php dynamic_sidebar( ‘secondary-widget-area’ ); ?>

    <?php endif; ?>

  • Het onderwerp ‘Widget area inactief?’ is gesloten voor nieuwe reacties.