• Raquel Wilson

    (@belindasuperstarr)


    I would like to have a recent post listing on the front page of my WP-powered site but I’d like it to be something like this

    News

    photo (entry #2)
    date (entry #2)
    headline (entry #2

    date (entry #1)
    headline (entry #1)

    I know this can be done using a PHP widget plugin, but I’m wondering if there is a recent posts plugin that will allow you to customize with a custom field.

    Any suggestions?

Viewing 2 replies - 1 through 2 (of 2 total)
  • <h3>Latest Instrumentals:</h3>
    			    <ol>
    
    				<?php
    				 $restriction1 = 'Vocal';
    				 $restriction2 = 'BackCatalog';
    				 $restriction3 = 'post_date';
    				 $value1 = 'None';
    				 $value2 = 'No';
    
    				 $querystr = "
    					SELECT * FROM $wpdb->posts
    					LEFT JOIN $wpdb->postmeta AS $restriction1 ON(
    					$wpdb->posts.ID = $restriction1.post_id
    					AND $restriction1.meta_key = '$restriction1'
    					)
    					LEFT JOIN $wpdb->postmeta AS $restriction2 ON(
    					$wpdb->posts.ID = $restriction2.post_id
    					AND $restriction2.meta_key = '$restriction2'
    					)
    					WHERE $wpdb->posts.post_status = 'publish'
    					AND $restriction1.meta_value = '$value1'
    					AND $restriction2.meta_value = '$value2'
    					LIMIT 10
    					";
    
    					$pageposts = $wpdb->get_results($querystr, OBJECT);
    
    					if ($pageposts):
    						foreach ($pageposts as $post):
    							setup_postdata($post); ?>
    							<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    						<?php  endforeach;
    					endif;
    					?>
    
    				</ol>

    where Vocal and BackCatalog are custom fields. Hope this helps.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom Field with Recent Posts’ is closed to new replies.