[Plugin: Post Teaser] No teaser on homepage (5 posts)

  1. thesambarnes
    Posted 7 years ago #

    Hi, I was just having a play with your plugin and it looks great, just what I was looking for.

    The only thing Id like to know is if there is a way to stop the teaser from showing on the front page? Its perfect for what I want to happen on archives and categories, but Id like my latest post to show in full on the homepage, with perhaps teasers of the older posts showing underneath - but that would be a nice to have, teasers just not showing in the homepage would be perfect.

    Is there a way to do this?



  2. julial49
    Posted 7 years ago #

    Yes, there is an easy way and it is independent of the plugin.

    Do you your way around WordPress conditional tags? The one you need is is_home() - see the codex page for details and examples.

    You'll need to insert the tags into the post teaser code.

  3. thesambarnes
    Posted 7 years ago #

    Hey Julia, thanks for the response. I'm ok with PHP, but could do with some advice on where to place this is_home() line.

  4. weyhan
    Posted 7 years ago #

    Hi thesambarnes,

    Unfortunately, no easy way because Post Teaser do not yet support configurable teasing depending on which page. There is two ways to do what you want to do. Both ways is kind of a hack at bast but should do what you want it to do.

    1. hack post-teaser.php to remove the is_home() check. Should be easy to locate by searching with your editor.

    2. In your theme, edit your php file for the homepage. If you share a php file for more then one page (e.g. archive page, search page, etc) you will need to add a is_home() page check and if is_home() is true, unhook Post Teaser by using this: remove_filter('the_content', 'pt_process'); Remember to do this before the loop.

    I recommend method #1 if you change your theme quite a lot. #2 if you don't want to edit post-teaser.php every time you upgrade Post Teaser to a new version or you don't care about upgrading Post Teaser.

    If you need more help, contact me with my contact form.

  5. metzbgsu
    Posted 6 years ago #

    This is interesting because I have the full post on my front page and only want the excerpt. I used the following code to put the post on my static front page, but now it just shows the whole post while everything else works fine.

    <?php $my_query = new WP_Query('showposts=1'); ?>
    <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
    <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>">
    <?php the_title(); ?></a>
    <?php the_excerpt(); ?>
    <?php endwhile; ?>

    Any suggestions on getting just the excerpt to show up? Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic