Support » Themes and Templates » Widgetizing Theme (Acting Up)

  • Can anybody help me with this? I’m having a heck of a time using widgets on a theme I got.

    My website is here:
    http://longrun.joelrunyon.com/

    The problem I’m having is the theme is supposedly “already widgetized” and the code seems to be inserted already:

    <div id=”sidebar”>
    <?php if ( 1 || (!function_exists(‘dynamic_sidebar’) || !dynamic_sidebar(1) )) : ?>
    <div class=”sidebar_box” id=”sidebar_news”>
    <h2>Company News</h2>
    <div class=”sidebar_box_body”>

    • Lorem ipsum dolor sit amet, to the consectetuer to adipiscing elit. for Quisque sed felis. Aliquam Read More
    • Lorem ipsum dolor sit amet, to the consectetuer to adipiscing elit. for Quisque sed felis. Aliquam Read More
    • Lorem ipsum dolor sit amet, to the consectetuer to adipiscing elit. for Quisque sed felis. Aliquam Read More

    </div><!– /sidebar_box_body –>
    </div><!– /sidebar_box –>
    <?php endif; ?>
    <?php if ( 1 || (!function_exists(‘dynamic_sidebar’) || !dynamic_sidebar(2) )) : ?>
    <div class=”sidebar_box” id=”sidebar_articles”>
    <h2>Useful Articles</h2>
    <div class=”sidebar_box_body”>

    </div><!– /sidebar_box_body –>
    </div><!– /sidebar_box –>
    <?php endif; ?>
    </div>

    The functions code is there too:

    if ( function_exists(‘register_sidebar’) ) {
    register_sidebars(1, array(
    ‘before_widget’ => ‘<div id=”%1$s” class=”widget %2$s”>’,
    ‘after_widget’ => ‘</div>’,
    ‘before_title’ => ‘<h2>’,
    ‘after_title’ => ‘</h2>’,
    ));

    I know how to usually widgetize a theme, but this is not working out at all…

    any help?

Viewing 5 replies - 1 through 5 (of 5 total)
  • When you go to Appearance and Widgets in your WP dashboard, are the places for you to put widgets? Looks like you should have two sidebars.

    P.S. You don’t happen to be related to Perry Runyon, do you? Went to school with him (San Antonio, Texas) more years ago than I really wish to admit. I think that’s kind of an odd name. 🙂

    Thread Starter joelrunyon

    (@joelrunyon)

    MY NAME IS NORMAL!!! haha. Just playin. No I don’t know a Perry. I was in San Antonio 2 summers ago though!

    About the sidebars. They do show up in the backend. I actually get 3 (which I thought was weird cause I could only find 2 in the code). 1 labled “sidebar” then “sidebar1” and “sidebar2.” I place my widgets just fine in the backend but when I goto the site, they don’t show up. I don’t know whats up.

    You might want to start over with the widgets. Decide where you want your widgets and how many you’ll want. In one design we did, I have custom widgetized sidebars for each page, plus an actual sidebar widget, and three footer widgets.

    Here’s my code. Notice that you can NAME each sidebar by including it between the ' in the parentheses. This goes in your functions.php file, I think you can figure out where to swap out the current widget code with this code. And of course, your styles will be different from mine, but this gives you an idea of their flexibility.

    if ( function_exists('register_sidebar') ){
        register_sidebar(array(
        'name' => 'sb-about',
        'before_widget' => '<div class="navbox">',
        'after_widget' => '</div>',
        'before_title' => '<h3 class="widgettitle">',
        'after_title' => '</h3>',
    ));
        register_sidebar(array(
        'name' => 'sb-contact',
        'before_widget' => '<div class="navbox">',
        'after_widget' => '</div>',
        'before_title' => '<h3 class="widgettitle">',
        'after_title' => '</h3>',
    ));
        register_sidebar(array(
        'name' => 'sidebar',
        'before_widget' => '<div class="navbox">',
        'after_widget' => '</div>',
        'before_title' => '<h3 class="widgettitle">',
        'after_title' => '</h3>',
    ));
        register_sidebar(array(
        'name' => 'footer1',
        'before_widget' => '<div class="navbox">',
        'after_widget' => '</div>',
        'before_title' => '<h3 class="widgettitle">',
        'after_title' => '</h3>',
    ));
        register_sidebar(array(
        'name' => 'footer2',
        'before_widget' => '<div class="navbox">',
        'after_widget' => '</div>',
        'before_title' => '<h3 class="widgettitle">',
        'after_title' => '</h3>',
    ));
        register_sidebar(array(
        'name' => 'footer3',
        'before_widget' => '<div class="navbox">',
        'after_widget' => '</div>',
        'before_title' => '<h3 class="widgettitle">',
        'after_title' => '</h3>',
    ));

    And then in your templates, call them as follows (place this line where you want the widget to appear):

    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('footer1') ) : ?>

    And don’t forget to change the name to match what you’ve laid out in your functions.php file. 🙂

    Thread Starter joelrunyon

    (@joelrunyon)

    I’m thinking I might just scrap the theme anyways…

    It’s not exactly what I’m looking for and it’s coded strangely…If I keep it, I’ll definitely take your advice. Thanks!

    Hi, Joel. The code that I posted above will work with just about any theme. 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Widgetizing Theme (Acting Up)’ is closed to new replies.