Random Custom Fields
-
Hi,
I’ve got several custom fields for each post in my website.
On the homepage, i’d like to show in the header, 3 of these custom fields, named “librairie”, “librairie_logo” and “librairie_nom”.
“librairie_nom” is text. “librairie_logo” is the picture of “librairie_nom” and “librairie” is the hyperlink of “librairie_logo”.
How can i do this with this code ?
<?php $random_query = new WP_Query(array( 'post__not_in' => $do_not_duplicate, 'showposts' => 7, 'cat' => 3, 'orderby' => 'rand', 'meta_query' => array( array( 'key' => 'couv', 'value' => '', 'compare' => '!=' ) ) )); echo ('<div style="font-size: 14px; font-weight: bold; color: #FFFFFF; text-transform: uppercase; text-shadow: 1px 1px 1px #000000; margin-bottom: -25px;margin-top: -130px; margin-right: 230px; position: relative; text-align: right;"><blink>également sur livresque</blink></div><br />'); while ($random_query->have_posts()) : $random_query->the_post(); ?> <div class="featured-random-apps" style="float:right"><br /><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><img src="<?php $values = get_post_custom_values("couv"); echo $values[0]; ?>" alt="<?php the_title(); ?>" width="86" height="135" border="0" /></a> </div> <?php endwhile; ?><div style="clear:both"><br /></div> <?php wp_reset_query(); ?>
Thanks.
- The topic ‘Random Custom Fields’ is closed to new replies.