Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter snor512

    (@snor512)

    1. About Sidebars, WP get_sidebar() vs dynamic_sidebar()

    2. About Widgets, wp Widget API and Widgetizing

    Thread Starter snor512

    (@snor512)

    aha! thanks! and sorry if my english isn’t very good. The other questions, as soon as i can, i’m going to try solving them, however all help is welcome.

    Thread Starter snor512

    (@snor512)

    And Michael, a hard-coded ‘wp_get_archive()’ in a sidebar.php’ is so like the code i have in my above sidebar.php?

    Thread Starter snor512

    (@snor512)

    Also and appending to the “1. widgets and sidebar and his relation” of the above comment , i have in my functions.php this:

    ...
    /**
     * Register widgetized area and update sidebar with default widgets
     *
     * @since sxo 1.0
     */
    function sabercomer_widgets_init() {
        register_sidebar( array(
            'name' => __( 'Primary Widget Area', 'sxo' ),
            'id' => 'sidebar-1',
            'before_widget' => '<aside id="%1$s" class="widget %2$s">',
            'after_widget' => '</aside>',
            'before_title' => '<h1 class="widget-title">',
            'after_title' => '</h1>'
        ) );
    
        register_sidebar( array(
            'name' => __( 'Secondary Widget Area', 'sxo' ),
            'id' => 'sidebar-2',
            'format'          => 'html',
            'before_widget' => '<aside id="%1$s" class="widget %2$s">',
            'after_widget' => '</aside>',
            'before_title' => '<h1 class="widget-title">',
            'after_title' => '</h1>',
        ) );
    }
    add_action( 'widgets_init', 'sxo_widgets_init' );
    ...

    And about the above “3. dynamic sidebars vs static sidebars”, i have found it could be useful: dynamic sidebars and content before and after

    Thread Starter snor512

    (@snor512)

    thanks! I see, i have just been seeing the content of default-widgets.php. And also, sidebars in wordpress and dynamic and static sidebars, and now i think that my main problem was (and now i am seeing this a little more clear): i was mixing/seeing wrongly this concepts and relations:

    1. widgets and sidebar and his relation. Still i have a little problem: i’m getting the sidebar what i want to generate, twice but in two unknown ways and i can’t see from where both different manners of producing the sidebar are being generated.
    Here, my sidebar.php file code:

    <?php
    /**
    * The Sidebar containing the main widget areas.
    *
    * @package sxo
    * @since sxo 1.0
    */
    ?>
    <div id="secondary" class="widget-area" role="complementary">
    
        <aside id="search" class="widget widget_search">
            <?php get_search_form(); ?>
        </aside>
    
        <aside id="archives" class="widget">
            <h1 class="widget-title"><?php _e( 'Archives', 'sxo' ); ?></h1>
            <ul class="archive-sidebar">
                <?php wp_get_archives( array( 'type' => 'monthly') ); ?>
            </ul>
        </aside>
    
        <aside id="meta" class="widget">
            <h1 class="widget-title"><?php _e( 'Meta', 'sxo' ); ?></h1>
            <ul>
                <?php wp_register(); ?>
                <li><?php wp_loginout(); ?></li>
                <?php wp_meta(); ?>
            </ul>
        </aside>
    
        <?php do_action( 'before_sidebar' ); ?>
    
        <?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?>
            <?php dynamic_sidebar( 'sidebar-1' ); ?>
        <?php endif; ?>
    
        <?php if ( is_active_sidebar( 'sidebar-2' ) ) : ?>
            <?php dynamic_sidebar( 'sidebar-2' ); ?>
        <?php endif; ?>
    </div>

    and his call from my front-page.php:

    <?php get_sidebar(); ?>

    (And i have the widget activated from wp admin panel)
    Do you know where could both sidebar codes being coming of?

    2. aside.php template (possible custom sidebar template, could it be?), sidebar.php (default wp sidebar, it isn’t so?)template.
    3. dynamic sidebars vs static sidebars (it seems too easy now)
    4. wp-includes/general-templates.php vs wp-includes/default-widgets.php, i can see about the different uses of these files some more clear.
    5 do_action( ‘before_sidebar’ ); (what is the location of the file associated to before_sidebar hook?)

    Thread Starter snor512

    (@snor512)

    Michael, the ‘Achives’ default widget is in wp-includes/general-template.php, it isn’t so?

    Thread Starter snor512

    (@snor512)

    thank you very much, Michael, i have tested your solution, and luckily, in my particular case, and thank to people like you and to communities like stakoverflow and wordpress, i finally got to do this to work: wp_get_archives links generated with css class atribute
    If you want, there, you and everybody can to see the problem and the solution that worked in my case in detail. And to add to this wordpress thread or/and stackoverflow another possible solutions if wished

Viewing 7 replies - 1 through 7 (of 7 total)