The MU forums have moved to WordPress.org

get sidebar doest work (7 posts)

  1. jasontower
    Member
    Posted 15 years ago #

    Hi,

    I use a theme, and in widget setting, i drag some pages in sidebar. In my own page, I want to load the theme. So I use:

    <? require('./wp-blog-header.php'); ?>
    <?php get_header(); global $wp_theme_options; ?>
    <div id="container" class="clearfix">
    <div id="content">
    <div class="entry">
    my text
    </div>
    </div><!--end content div-->
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    The get header works well, but get sidebar and get footer dont work
    Any help would be appreciated.
    Thanks

  2. andrea_r
    Moderator
    Posted 15 years ago #

    If you want to load your theme in a special page, you need to make a Page template.
    http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates

  3. jasontower
    Member
    Posted 15 years ago #

    Thanks

  4. jasontower
    Member
    Posted 15 years ago #

    Sorry, it doesnt work
    I think it may be due to the widget
    Any one who know how to get the multi-widget in the sidebar?
    Something starts like this:

    <div class="sidebar">
    
    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Sidebar') ) : ?>
  5. andrea_r
    Moderator
    Posted 15 years ago #

    "it doesnt work" isn't specific enough. Without a clear idea of what you're trying to do, and what specifically doesn't work, then all we can give is general advice. maybe a link to see how far you got?

    Also: http://codex.wordpress.org/Widgetizing_Themes

    And the creating a page template above does actually work.

  6. jasontower
    Member
    Posted 15 years ago #

    Sorry, I didn't make it clearly.
    I have two widgets which appear on the theme page. Now I want to load them in my own page. So I use the code`
    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>

    <div class="widget-wrap">
    <div class="widget">
    <h4><?php _e("Widget Section"); ?></h4>
    <p>mytext</p>
    </div>
    </div>

    <div class="widget-wrap">
    <div class="widget">
    <h4><?php _e("Widget Section"); ?></h4>
    <p>mytext</p>
    </div>
    </div>`
    But it only loads two empty frame widget on the sidebar.
    I know I should give some parameter which presents my real sidebar widgets in the function dynamic_sidebar(), but I dont know what it is. Could anyone tell me where or in which file I can find this parameter?
    Thanks.

  7. andrea_r
    Moderator
    Posted 15 years ago #

    "I know I should give some parameter which presents my real sidebar widgets in the function dynamic_sidebar(), "

    No, you don't put anythign in there to represent your widgets.

    You need <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?> before the widgetized area and <?php } ?> after it, and you can literally put nothing in between them in the code.

    Then when you move widgets around in the backend, this area will show them. The top line needs to be *exactly the same* as it is in your sidebar.php file.

About this Topic

  • Started 15 years ago by jasontower
  • Latest reply from andrea_r