mardi 22 mars 2022

How to display random custom html widget within a widget area?

I've registered a new widget area in functions.php using

        'name' => __( 'Grand angle sous les articles', 'twentyten' ),
        'id' => 'grand-angle',
        'description' => __( 'Grand angle en bas des articles', 'twentyten' ),
        'before_widget' => '<div id="grand-angle">',
        'after_widget' => '</div>',
        'before_title' => '',
        'after_title' => '',
    ) );

I'm calling this new widget area in a php template like this :

<?php if ( is_active_sidebar( 'grand-angle' ) ) : dynamic_sidebar( 'grand-angle' ); endif; ?>

Inside this new widget area I'm now adding several custom html widgets and I would like to display them randomly. These custom html widgets contain ads (mostly images) and I need to set up a rotation. Any idea how to do that? Thank you very much for your help.




Aucun commentaire:

Enregistrer un commentaire