• Resolved TataVostru

    (@tatavostru)


    I want to display post from a specific category using post_type

    Ex:

    post Type – Stiri
    Category – Lansari
    Category – Mondene

    i have somting like this

    <?php
    $recentPosts = new WP_Query();
    $recentPosts->query(array('showposts' => 1, 'post_type' =>array('stiri')));
    ?>
    <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>
    <div class="sidebar-titlu"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></div>
    <div class="sidebar-stiri">
    <img src="/scripts/timthumb.php?src=<?php the_field('imagine_stire'); ?>&h=60&w=90&zc=1" alt="" title="<?php the_title(); ?>" />
    <?php $excerpt = get_the_excerpt();echo string_limit_words($excerpt,30);?><a class="detalii" href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s', 'kubrick'), the_title_attribute('echo=0')); ?>">...detalii</a>
    </div>
    </div>
    <?php endwhile; ?>

    How can i retrive only the posts from that categoy under post_type

    Here is an image :

    http://www.diviziatm.ro/1.png

    Site: http://cinema.trancelevel.com/stiri/soparla-antagonistul-din-the-amazing-spider-man/

    [ don’t bump – it is not permitted here ]

Viewing 1 replies (of 1 total)
  • Thread Starter TataVostru

    (@tatavostru)

    found

    <?php
    $recentPosts = new WP_Query();
    $recentPosts->query(array(
        'post_type' => 'stiri',
        'showposts' => 1,
        'taxonomy' => 'stire',
        'field' => 'The category from post_type -- The ID ',
        'orderby' => 'title',
        'order' => 'ASC' )
    );
    ?>
Viewing 1 replies (of 1 total)

The topic ‘Display post from a specific category using post_type’ is closed to new replies.