• Resolved SteveYantz

    (@steveyantz)


    I would like to display my post’s of a category as a list of urls ordered by an added field to the table named ‘post_episode.’

    More detailed:
    On a post page, I need to displaya list of links on the post template.
    ex/
    episode 1
    episode 2
    episode 3
    episode 4…

    Each post in a category stands for an episode.
    So category = family guy.
    and it’s posts are the episodes.

    I want to grab all the episodes of the current displayed episode’s category and list them as urls in a ul. Most importantly, sort them by the post_episode field.

    Starting from the basics.
    How can I call the post’s into an array, where each post’s category = <?php the_category(‘, ‘); ?>.
    There is no connection in the post table to connect it to a category id, name, or anything.

Viewing 1 replies (of 1 total)
  • I think you can use a normal query to do what you want, but I am not quite sure. If you only want to list episodes for one category, ordered by episode number, a query like this should work:

    <?php
    $category_name = 'family guy';
    $args = array (
       'category_name' => $category_name,
       'meta_key' => 'episode',
       'orderby' => 'meta_value',
       'caller_get_posts' => 1
    );
    query_posts($args);
    if (have_posts()) : while (have_posts()) : the_post(); ?>
      <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    <?php endwhile; endif; ?>
Viewing 1 replies (of 1 total)
  • The topic ‘I would like to display my post’s of a category as a list of urls ordered by …’ is closed to new replies.