How to get articles from a custom field to display to a specific post (1 post)

  1. TataVostru
    Posted 3 years ago #

    Hy im building a cinema site..


    How can i get the news that contain the movie title...

    For example i have this :

    $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(__('%s'), the_title_attribute('echo=0')); ?>">...detalii</a>
    <?php endwhile; ?>
    $recentPosts = new WP_Query();
    $recentPosts->query(array('showposts' => 5, 'post_type' =>array('stiri')));
    <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>
    <li><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></li>
    <?php endwhile; ?>

    How can i get the news by tag.

    For example: if i have a news and have tag the Amaizing Spiderman....i want to apear in the right in sidebar.

    For Movies - i use POST
    For Stiri - i use post_type

    If ennybody knows please post... or how can i get the news other way... custom field... etc...

    [ Please do not bump, it's not permitted here. ]

Topic Closed

This topic has been closed to new replies.

About this Topic