vendredi 13 novembre 2015

How can I display data from custom post type marked as ‘featured post’ within a page template?

I am trying to achieve the following: I have a custom post type called ‘album’. I am using the Featured Post plugin (http://ift.tt/1RUwwNt) to select one of the albums. I want to display some data from that album in the sidebar of a page template.

At the moment the code I’m using is not returning anything:

<div class="left-column">
    <?php query_posts(array('post_type' => 'album') ); ?>
    <?php query_posts($query_string."&featured=yes"); ?>
    <?php while ( have_posts() ) : the_post(); ?>
        <h3>Latest Release</h3>
        <?php echo get_the_post_thumbnail($post->ID, 'post-thumbnail'); ?>
        <div class="purchase">
            <h3>Purchase now</h3>
            <ul>
                <li><a href="<?php the_field('itunes_link')?>" target="_blank"><img src="http://localhost:8888/rezzonator/wp-content/uploads/2015/11/itunes.png"></a></li>
                <li><a href="<?php the_field('paypal_link')?>" target="_blank"><img src="http://localhost:8888/rezzonator/wp-content/uploads/2015/11/paypal.png"></a></li>
            </ul>
        </div>
    <?php endwhile; // End of the loop. ?>
</div>

Can somebody help? I’m fairly new to PHP coding…

Many thanks,



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire