WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] about cat and category_name? (3 posts)

  1. taghaboy
    Member
    Posted 4 years ago #

    Hi,
    i know that the cat accept many id, exemple:
    <?php query_posts('cat=1,2,3'); ?>

    so, how can i do the some with the category_name
    <?php query_posts('category_name=one,two,tree'); ?>

    is it possible???

  2. MichaelH
    Member
    Posted 4 years ago #

    <?php
    $cat1=get_cat_ID('Currently Playing');
    $cat2=get_cat_ID('cat1');
    $cat3=get_cat_ID('idaho');
    
    $args=array(
      'cat' => $cat1 . ',' . $cat2. ',' .$cat3,
      'post_type' => 'post',
      'post_status' => 'publish',
      'posts_per_page' => -1,
      'caller_get_posts'=> 1
    );
    $my_query = null;
    $my_query = new WP_Query($args);
    if( $my_query->have_posts() ) {
      echo 'List of Posts';
      while ($my_query->have_posts()) : $my_query->the_post(); ?>
        <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
        <?php
      endwhile;
    }
    wp_reset_query();  // Restore global post data stomped by the_post().
    ?>
  3. taghaboy
    Member
    Posted 4 years ago #

    thanks

Topic Closed

This topic has been closed to new replies.

About this Topic