• Resolved piratescott

    (@piratescott)


    So basically I’m trying to make a list of posts that aren’t published yet. http://streakingpirates.com/mytestpage/ her’s my result and as you can see the post titles are showing 3 times per image.

    Here’s my code:

    <ul>
    <?php
    
    echo '<ul>';
    	$args = array( 'post_status' => 'pending');
    	$recent_posts = wp_get_recent_posts ( $args );
        $thumbnails = get_posts($args,'numberposts=5');
        foreach ($thumbnails as $thumbnail) {
          echo '<li><a href="' . get_permalink( $thumbnail->ID ) . '" title="' . esc_attr( $thumbnail->post_title ) . '">';
    		echo get_the_post_thumbnail($thumbnail->ID, 'thumbnail');
          echo '</a></li>';
    
    	foreach( $recent_posts as $recent ){
    		echo '<li class="vote-title"><a href="' . get_permalink($recent["ID"]) . '" title="Look '.esc_attr($recent["post_title"]).'" >' .   $recent["post_title"].'</a> '. $recent["the_author"].' </li>';
    	}
    
    	}
    
    echo '</ul>';
    
    ?>
    
    </ul>

    Pretty much new to php (as of today and minor experiences which were more html related in the past) and just about getting my head around it so any help would be greatly appreciated thanks 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • I just checked the page, it seems to be resolved. Did you work it out?

    Thread Starter piratescott

    (@piratescott)

    Yep cheers.

    <?php
    	$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    	$args = array( 'post_status' => 'pending', 'posts_per_page' => 20, 'paged'=>$paged);
    	$recent_posts = new WP_Query( $args );
    ?>
    
    <?php while ( $recent_posts->have_posts()) {
        $recent_posts->the_post();
        echo '<div id="votes"><li id="voteimage"><a href="' . get_permalink() . '" title="' . esc_attr( $recent["post_title"] ) . '">';
        echo get_the_post_thumbnail($recent["ID"], 'thumbnail');
        echo '</li></a>';
        echo '<li class="vote-title"><a href="' . get_permalink() . '" title="Look '.esc_attr($recent["post_title"]).'" >' . get_the_title() .'</a> </li>';
        echo '<li class="vote-desc"><a href="' . get_permalink() . '">' . get_the_excerpt(10) . '</a> </li>';
    	echo '<ul class="vote-footer"><li>Author: <a href="http://streakingpirates.com/forum/users/' . get_the_author() . '">' . get_the_author() . '</a></li></ul>';
        echo '</div>';
    	}
    ?>
    <div id="vote-pages">
    <div id="vote-older">
    <?php next_posts_link(  '« Older Posts' , $recent_posts->max_num_pages ); ?>
    </div>
    <div id="vote-newer">
    <?php previous_posts_link('Newer Posts »'); ?>
    </div>
    </div>

    Is the code for it incase anybody ever needs it and finds this.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Showing 3 titles for each image’ is closed to new replies.