Support » Themes and Templates » How do I make this loop show up, so I don't have to use templates?

  • Iva

    (@supersonicsquirrel)


    Hello,

    I used this tutorial to make a loop to show items from a specific taxonomy and it worked fine; as I needed it the way they wrote it – as items of a list I wrapped around it.

    http://digwp.com/2010/01/custom-query-shortcode/

    However, I need to create one more similar shortcode, that would show a bigger, more detailed loop, with excerpt and custom fields.

    <div class="recent-release boxxie">
    <p><strong><!---<a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>">--><?php the_title(); ?><!---</a>--></strong>
    <?php if ( has_post_thumbnail() )
       the_post_thumbnail( array( 80, 80 ), array( 'class' => 'alignleft') ); else { ?><?php } ?><br />
    <strong>Released:</strong> <?php the_time('F j, Y') ?><br />
    <strong>Release format:</strong> <?php $key="Release Format"; echo get_post_meta($post->ID, $key, true); ?><br />
    <strong>Label:</strong> <?php $key="Record Label"; echo get_post_meta($post->ID, $key, true); ?></p>
    <?php the_excerpt(__('Read on...','imseven')); ?>
    </div><div class="clear">&nbsp;</div>

    So, I was wondering how to write this properly, so I don’t crash my own website when I replace the output of the function with it. I understand that title and link to the item from the recentrelease custom post type need to be replaced, but how do I go about everything else?

    I really don’t want to create a bunch of almost identical template files solely to output things with different taxonomies; a shortcode would be easier.

    Many thanks. 🙂

  • The topic ‘How do I make this loop show up, so I don't have to use templates?’ is closed to new replies.