WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] how to use the same widget twice (8 posts)

  1. blueyez
    Member
    Posted 4 years ago #

    i can't find anything to help with this :((

    i want to apply a widget on the sidebar, and the same widget on the front page footer.

    thz

  2. blueyez
    Member
    Posted 4 years ago #

    how can i call the widget directly into my theme ?

  3. kmessinger
    Volunteer Moderator
    Posted 4 years ago #

    Well you might try looking at your source code, identify the code for the widget, copy that code and place it into your footer.php

  4. Rev. Voodoo
    Volunteer Moderator
    Posted 4 years ago #

    or set up a widget area in your footer...

    something like this in functions.php (between the php tags) will register the new widget area

    if ( function_exists('register_sidebar') )
        register_sidebar(array(
             'name'=>'footer_left',
            'before_widget' => '<div id="%1$s" class="widget %2$s">',
            'after_widget' => '</div>',
            'before_title' => '<h3>',
            'after_title' => '</h3>',
        ));

    And this in footer.php (or anywhere in a theme really) will add the widget area to the theme:

    <div class="footWidget">
    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('footer_left') ) : ?>
    <?php endif; ?>
    </div>

    of course then you would have to style the .footWidget in your css

    .footWidget {
            float: left;
            width: 340px;
            }

    worked for me....but yours will have to be changed most likely.....to whatever works in your theme

  5. blueyez
    Member
    Posted 4 years ago #

    i have 4 dynamic sidebars

    main page box 1
    main page box 2
    main page box 3
    pages sidebar

    i want to use yahoo status plugin widget in "main page box 3" and "pages sidebar"

    the widget is not widget_api ready wp 2.8 so i can use it only one time.
    i have no idea how to convert it into the new api ( i don't know php )

    tried to use http://wordpress.org/extend/plugins/jaw-duplicate-widgets/
    but is also outdated and doesn't work

  6. voyagerlife
    Member
    Posted 4 years ago #

    Hi everybody,
    I have the same problem and I want add a footer widget, as far as ı understand after I read the notes above;
    I need to find out this part in my functions.php

    if ( function_exists('register_sidebar') )
    register_sidebar(array(
    'name'=>'footer_left',
    'before_widget' => '<div id="%1$s" class="widget %2$s">',
    'after_widget' => '</div>',
    'before_title' => '<h3>',
    'after_title' => '</h3>',
    ));

    then I need to copy and paste it to the footer.php
    then I need to paste the code below too to the footer.php

    <div class="footWidget">
    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('footer_left') ) : ?>
    <?php endif; ?>
    </div>

    then I need to paste the code below to the style.css

    .footWidget {
    float: left;
    width: 340px;
    }

    Did I do the right things? Is this the right way?
    Because I use Ahimsa Theme and these things didn't work on my theme.
    Can anybody help me?

  7. kmessinger
    Volunteer Moderator
    Posted 4 years ago #

    blueyz - Widgets that come with WP can be used in mutiple sidebars with no problem. For a plugin widget you might take the code and put it into your second sidebar with a text widget.

    voyagerlife - no, the top portion of the code you need to put into functions.php. It does not go into the footer.php

  8. voyagerlife
    Member
    Posted 4 years ago #

    unfortunately it doesn't work on my theme.

Topic Closed

This topic has been closed to new replies.

About this Topic