如何讓不同的 sidebar 呈現在不同的 page?
-
請教各位, 如題.
以下, 是我的 page.php code:
<?php
/**
* Template Name: Fullwidth Page
*/get_header(); ?>
<div id=”content”>
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<div id=”post-<?php the_ID(); ?>” <?php post_class(‘page’); ?>>
<?php if(has_post_thumbnail()) {
echo ‘‘;
echo ‘<figure class=”featured-thumbnail”><span class=”img-wrap”>’; the_post_thumbnail(); echo ‘</span></figure>’;
echo ‘‘;
}
?><?php the_content(); ?>
<div class=”pagination”>
<?php wp_link_pages(‘before=<div class=”pagination”>&after=</div>’); ?>
</div><!–.pagination–>
</div><!–#post-# .post–><?php endwhile; ?>
</div><!–#content–>
<?php get_footer(); ?>以下, 是我的 sidebar.php code:
<aside id=”sidebar” class=”grid_5 maxheight <?php if (of_get_option(‘blog_sidebar_pos’)==’right’) {echo ” prefix_1″;} else {echo ” suffix_1″;} ?>”>
<?php if ( ! dynamic_sidebar( ‘Sidebar’ )) : ?>
<div id=”sidebar-search” class=”widget”>
<?php echo ‘<h3>’ . __(‘Search’, ‘theme1556’) . ‘</h3>’; ?>
<?php get_search_form(); ?> <!– outputs the default WordPress search form–>
</div><div id=”sidebar-nav” class=”widget menu”>
<?php echo ‘<h3>’ . __(‘Navigation’, ‘theme1556’) . ‘</h3>’; ?>
<?php wp_nav_menu( array(‘menu’ => ‘Sidebar Menu’ )); ?> <!– editable within the WordPress backend –>
</div><div id=”sidebar-archives” class=”widget”>
<?php echo ‘<h3>’ . __(‘Archives’, ‘theme1556’) . ‘</h3>’; ?>-
<?php wp_get_archives( ‘type=monthly’ ); ?>
</div>
<div id=”sidebar-meta” class=”widget”>
<?php echo ‘<h3>’ . __(‘Meta’, ‘theme1556’) . ‘</h3>’; ?>-
<?php wp_register(); ?>
- <?php wp_loginout(); ?>
<?php wp_meta(); ?>
</div>
<?php endif; ?>
</aside><!–sidebar–>
- The topic ‘如何讓不同的 sidebar 呈現在不同的 page?’ is closed to new replies.