• Resolved l3monade

    (@l3monade)


    I am trying to post a small selection of text/links on my front page but not on any other page.

    Here is the code which works fine but shows up all all pages:

    <?php query_posts('cat=3&showposts=1'); ?>
    <?php while (have_posts()) : the_post(); ?>
    <h1>Featured Topic</h1>
    <Strong><?php the_title(); ?></strong>
    <p><?php the_content_limit(500,""); ?></p>
    <a href="<?php the_permalink() ?>">Click to learn more</a>
    <?php endwhile;?>

    I am using a plug-in to limit the text. My home page is a page not a blog roll/post.

    I’m sorry if this is answered somewhere else…I’ve had a good look and couldn’t find anything.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Try:

    <?php if( is_front_page() ) : ?>
    <?php query_posts('cat=3&showposts=1'); ?>
    <?php while (have_posts()) : the_post(); ?>
    <h1>Featured Topic</h1>
    <Strong><?php the_title(); ?></strong>
    <p><?php the_content_limit(500,""); ?></p>
    <a href="<?php the_permalink() ?>">Click to learn more</a>
    <?php endwhile;?>
    <?php endif;?>
    Thread Starter l3monade

    (@l3monade)

    Works.

    Thank you very much.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Show something only on home page’ is closed to new replies.