WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hi I am using the yootheme master collection and I wish to get a list of 10 permalinks from this custom post catagory but at the moment I can only get 1 to show. How do I do this properly?


<div id="rec-p" style="width:80%; height:100%; border:2px dotted red; float:left; ">

<?php if (have_posts()) : ?>

    <?php if (is_category()) : ?>
        <?php /* <h1 class="page-title">Archive for the &#8216;<?php single_cat_title(); ?>&#8217; Category</h1> */ ?>
    <?php elseif (is_tag()) : ?>
        <h1 class="page-title"><?php printf(__('Posts Tagged %s', 'warp'), '&#8216;'.single_tag_title('', false).'&#8217;'); ?></h1>
    <?php elseif (is_day()) : ?>
        <h1 class="page-title"><?php printf(__('Archive for %s', 'warp'), get_the_date()); ?></h1>
    <?php elseif (is_month()) : ?>
        <h1 class="page-title"><?php printf(__('Archive for %s', 'warp'), get_the_date('F, Y')); ?></h1>
    <?php elseif (is_year()) : ?>
        <h1 class="page-title"><?php printf(__('Archive for %s', 'warp'), get_the_date('Y')); ?></h1>
    <?php elseif (is_author()) : ?>
        <h1 class="page-title"><?php _e('Author Archive', 'warp'); ?></h1>
    <?php elseif (isset($_GET['paged']) && !empty($_GET['paged'])) : ?>
        <h1 class="page-title"><?php _e('Blog Archives', 'warp'); ?></h1>
    <?php endif; ?>

    <?php $currentid = get_the_id(); ?>

    <h2><a href="<?php the_permalink(); ?>"><?php echo get_the_title($currentid); ?></a></h2>

<?php else : ?>

    <?php if (is_category()) : ?>
        <h1 class="page-title"><?php printf(__("Sorry, but there aren't any posts in the %s category yet.", "warp"), single_cat_title('', false)); ?></h1>
    <?php elseif (is_date()) : ?>
        <h1 class="page-title"><?php _e("Sorry, but there aren't any posts with this date.", "warp"); ?></h1>
    <?php elseif (is_author()) : ?>
        <?php $userdata = get_userdatabylogin(get_query_var('author_name')); ?>
        <h1 class="page-title"><?php printf(__("Sorry, but there aren't any posts by %s yet.", "warp"), $userdata->display_name); ?></h1>
    <?php else : ?>
        <h1 class="page-title"><?php _e("No posts found.", "warp"); ?></h1>
    <?php endif; ?>

    <?php get_search_form(); ?>

<?php endif; ?>

share|improve this question
Your loop does not use your $my_query and also is incomplete. See example: WP_Query Usage. – Max Yudin Feb 11 '13 at 14:56
Hi sorry $my_query was not supposed to be there I have changed it now. Any advice? Thanks – MrThunder Feb 11 '13 at 15:27
up vote 0 down vote accepted

As I've mentioned in the comment to the question, your loop is incomplete. You need while loop to iterate through posts and the_post() function to get those posts one by one:

// if there are posts
if ( have_posts() ) :
    // iterate through all posts
    while ( have_posts() ) :
        // get post data
        // your post here 
    // if no posts;
endif; ?>

See Codex:

share|improve this answer
Thanks I got it to work :) – MrThunder Feb 13 '13 at 10:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.