WP - 内容代码使子页面不会出现在侧边栏中

时间:2010-10-04 09:19:10

标签: wordpress templates

在我的一个wordpress模板中,内容代码似乎使子页面菜单不会显示在侧边栏中。当我从内容div中删除所有代码时,子页面菜单将按预期显示。

有人能指出代码出错的地方吗?

非常感谢任何帮助!

<div id="content">

        <div class="pageinfo clearfix">
    <div class="info">
    <h1><?php the_title();?></h1>
    </div>
</div>

        <?php
            global $more;
            // set $more to 0 in order to only get the first part of the post
            $more = 0; 
            global $post;
            $myposts = query_posts("category_name=intern&posts_per_page=3");
            foreach($myposts as $post) :
            setup_postdata($post);
        ?>
        <div class="postitem clearfix">
            <div class="new"></div>
            <div class="info">
                <h2><a href="<?php the_permalink()?>"><?php the_title()?></a></h2>
                <?php the_date()?> | Skrevet af <?php the_author_posts_link(); ?> | Gemt under:
                <?php
                // heres just the name and permalink:
                foreach((get_the_category()) as $category) { 
                    $category_name = $category->category_nicename . ' '; 
                    $category_link = get_category_link($category->cat_ID);
                    echo "<a href='$category_link'>$category_name</a>";
                } 
                ?>
            </div>
                <?php
                $thumb = get_post_meta($post->ID,'_thumbnail_id',false);
                $thumb = wp_get_attachment_image_src($thumb[0], false);
                $thumb = $thumb[0];?>

                <?php if($thumb != NULL) { ?>
                    <a href="<?php the_permalink() ?>">
                    <img src="<?php bloginfo('template_directory'); ?>/scripts/timthumb.php?src=<?php echo $thumb ?>&h=110&w=110&zc=1" alt="<?php the_title(); ?>" width="110" height="110" class="leftImage" >
                    </a>
                <?php } ?>

                <?php the_content('<br />Læs resten her » '); ?>
                <div class="clearBoth"></div>



        </div><!-- /postitem -->
        <?php endforeach; ?>


    </div><!-- /content -->

1 个答案:

答案 0 :(得分:0)

在您的侧边栏加载之前(以及rewind_posts(); 之后),在某处尝试wp_reset_query();endforeach