[resolved] Need SINGLE CATEGORY feed... currently have FULL blog feed... help? (4 posts)

  1. ButterflyHerder
    Posted 6 years ago #


    I've been trying to get support from iThemes, but they've yet to respond. I'm on deadline, so I hope somebody here can help.

    The code below feeds into a specific area on my client's website. CURRENTLY, it feeds ALL of the blog posts.

    I want it to feed only CATEGORY 12.

    What part of this code do I need to edit to make this happen?

    <div id="pop" class="hiddencontent">
    		<?php $my_query = "showposts=4"; $my_query = new WP_Query($my_query); ?>
    		<?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
    		<h5><a href="<?php the_permalink(); ?>" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h5>
    		<p><?php the_time('F j, Y') ?><br />
    		by: <?php the_author_link(); ?> &bull; <?php the_category(', ') ?></p>
    		<?php endwhile; ?>

    Thanks in advance!

  2. s_ha_dum
    Posted 6 years ago #

    You need to edit your WP_Query parameters-- this bit, $my_query = "showposts=4";. The Codex page has exactly what you need right here (WP_Query takes the same parameters as query_posts). Your query should end up looking something like $my_query = "showposts=4&cat=12";

  3. ButterflyHerder
    Posted 6 years ago #

    Awesome! Thanks so much!

  4. chittala
    Posted 6 years ago #

    sorry for adding a new topic. i want to add a feed in my jtabber section in the ithemes wordpress theme. plz let me know how do i do that. thanks in advance

Topic Closed

This topic has been closed to new replies.

About this Topic