开发者

WP – Content code keeps subpage from appearing in sidebar

开发者 https://www.devze.com 2023-01-18 11:24 出处:网络
In one of my wordpress templates, the content code seems to keep the subpage menu from displaying in the sidebar. When ever I remove all code from the content div, the subpage menu appears as expected

In one of my wordpress templates, the content code seems to keep the subpage menu from displaying in the sidebar. When ever I remove all code from the content div, the subpage menu appears as expected.

Could anyone point out where the code goes wrong?

Any help would be greatly appreciated!

<div id="content">

        <div class="pageinfo clearfix">
  开发者_StackOverflow中文版  <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 -->


try rewind_posts(); or wp_reset_query(); somewhere before your sidebar is loaded up (and after the endforeach).

0

精彩评论

暂无评论...
验证码 换一张
取 消