Error: Posts From Specific Categories On Main Page
-
Hello,
I have upgraded from 2.0.7 (to 2.1) and am having difficulty getting my mainpage template to work properly again. In my former working (2.0.7) templates, I was following the instructions as outlined on this excellent URL (How to Use WordPress to Run A Magazine). It worked flawlessly under 2.0.7.
If someone could please look at the code below and suggest a solution, it’d extremely appreciated. There are two sections, for example purposes.
The first section is to call in 1 post from category 4 and then insert the “more” text (continue reading) at the point I entered in the <!–more–> tag in the original post.
The section section is identical to the one above, except I am trying to pull in 3 posts from category 6 instead.
Any help is, again, appreciated.
<?php $posts = get_posts( "category=4&numberposts=1" ); ?>
<?php if( $posts ) : ?> <?php foreach( $posts as $post ) : setup_postdata( $post ); ?>
<h2><a href="<?php the_permalink() ?>" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
<?php the_content("Continue reading '" . the_title('', '', false) . "'"); ?>
<?php endforeach; ?>
<?php endif; ?>
<?php $posts = get_posts( "category=6&numberposts=3" ); ?>
<?php if( $posts ) : ?> <?php foreach( $posts as $post ) : setup_postdata( $post ); ?>
<h2><a href="<?php the_permalink() ?>" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
<?php the_content("Continue reading '" . the_title('', '', false) . "'"); ?>
<?php endforeach; ?>
<?php endif; ?>
- The topic ‘Error: Posts From Specific Categories On Main Page’ is closed to new replies.