• Hey guys!

    I’ve been trying to find a solution to something that should be rather simple, without any success.

    I’m building a portfolio theme. My index page display a feed of all my projects, showing thumbnails and titles from each post.

    Once clicked, the single.php file is loaded, and content of that post/project is displayed.

    What I want is, basically, to put the content of index.php below the content of the single post content in single.php

    What I want to do with single.php is the following:

    TITLE OF SINGLE POST

    CONTENT OF SINGLE POST

    LIST OF ALL MY PROJECTS/POSTS
    (Displaying the post thumbnails and titles)

    I’ve been reading all there is to read about multiple loops etc, but I simply can’t figure it out…

    Any help would be hugely appreciated!

Viewing 1 replies (of 1 total)
  • You would want to use WP_Query to get all of your posts. Something like this:

    <?php
    
    // The Query
    $args = array( 'post_type' => 'post' );
    $the_query = new WP_Query( $args );
    
    // The Loop
    if ( $the_query->have_posts() ) {
    	while ( $the_query->have_posts() ) {
    		$the_query->the_post();
    		echo '<li>' . get_the_title() . '</li>';
    	}
    } else {
    	// no posts found
    }
    /* Restore original Post Data */
    wp_reset_postdata();
Viewing 1 replies (of 1 total)
  • The topic ‘Recent posts below content of single post?’ is closed to new replies.