• 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; ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • https://codex.www.ads-software.com/Template_Tags
    Compare the ‘deprecated’ tags to the new ones (they have 2.1 beside them) to see which tags you need to change.

    Thread Starter Rongo

    (@rongo)

    Samboll: I had already checked there before coming here. Unless I am completely blind, none of the tags I am using in my code above are listed on the Template Tags page as “deprecated”.

    The tags I am using: get_posts, the_title, and the_content, have no (2.1) next to them nor are they listed as deprecated from what I can tell. Am I missing something obvious?

    The “more” tags are ignored here as well, for some reason. I just don’t get it.

    Thread Starter Rongo

    (@rongo)

    To follow up, if I can get the “more” option to work here, I think I’ll be fine. The more tags are getting ignored. Any suggestions?

    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Error: Posts From Specific Categories On Main Page’ is closed to new replies.