WordPress.org

Support

Support » Themes and Templates » Titles in category in sidebar – 1 post showing

Titles in category in sidebar – 1 post showing

  • Hi all,

    In the main content div of my page I have the following:

    <?php query_posts('category_name=homily'); ?>
    
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    
    <div class="post">
    
    <h2><?php the_title(); ?></h2>
    <?php the_time('F jS, Y'); ?>
    
    <?php the_content(); ?>
    </div>
    
             <?php endwhile; else: ?>
             <p>Sorry, no posts matched your criteria.</p>
             <?php endif; ?>

    which shows all the posts in the “homily category”. What I really want is for it to show only the latest post, and then to have a sidebar div with titles of the posts in that category. I want the user to be able to click the title and read that particular post in the same page. Is what I’m looking for possible without the need to create a theme?

    Thank you,

    Sepehr

  • The topic ‘Titles in category in sidebar – 1 post showing’ is closed to new replies.
Skip to toolbar