WordPress.org

Support

Support » How-To and Troubleshooting » How to Show All Post Types

How to Show All Post Types

  • Hi,

    My wordpress site has custom post type (about, portfolio, contact) and I’d like to know if there’s a way to show all the post types and their contents in one page.

    My website is;

    http://www.parabolastudio.com/

    Currently the front is a static page.

    Thank you!!!

    Jaeeun

Viewing 15 replies - 1 through 15 (of 21 total)
  • Hi jaeeun, you say your site is static but then you also mention that you have some post type (about, portfolio, contact).

    I was wondering if you wanted to create a blog? Your post type should be pages and then you can create some post which will become your blog.

    The post will be dynamic and the pages static.

    Is that what you want to do?

    Hi mbrsolution,

    Thanks for responding to my post.

    What I want to do is actually something like this;

    http://www.eladian.com/

    I see what you want.

    You will have to set your wordpress to your latest post. Then you will have to create a menu with links to each post. Those links will be anchor links.

    Example:

    <a name="TOC">Table of Contents</a>

    To link to the anchor above you’d code your link like this:

    <a href="#TOC">Table of Contents</a>

    I hope this helps you.

    Kind regards

    Thanks you- but I’ve set it to my latest post and nothing shows up…!

    http://www.parabolastudio.com/

    Can you tell me how many post you have published? Can you also let me know your settings?

    I’ve posted four- three under Portfolio, and the Contact post. Which settings should I let you know of?

    I have created 2 post using the default theme Twenty Eleven. I have published both post.

    I have my WordPress set to the latest post and I see both post there on the front page.

    I have also created 4 pages. The pages are added to the top menu and the side menu.

    Have a look at my link

    Kind regards

    If you have developed your own them then you might be missing some code on the default page “home page” that is why your post are not showing.

    If you use the default theme Twenty Eleven you will see that the post will be published to the front page following my settings above.

    You can also copy that code and use it on your own theme to display the post on the front page.

    Let me know what you think?

    You will need to create a wp_query that displays all of your custom post types at once, review the wp_query docs:

    http://codex.wordpress.org/Class_Reference/WP_Query

    I edited home.php as mbrsolution suggested, and now it shows the content box, which is good!

    But it’s still empty… I looked into the codex page that tiaanswart posted and pasted this code with my custom post types in my home.php;

    $query = new WP_Query( array( ‘post_type’ => array( ‘post’, ‘page’, ‘movie’, ‘book’ ) ) );

    but no posts shows up…!

    did you introduce a new loop with your query?

    This is how my home.php looks now;

    http://pastebin.com/bg3S2z3T

    Check your code? See example below.
    $query = new WP_Query( array( 'post_type' => array( 'post', 'page', 'movie', 'book' ) ) );

    try this:

    <?php get_header(); ?>
        <?php get_sidebar(); ?>
    
        <div id="content" class="group">
    
        <?php $query = new WP_Query( array( 'post_type' => array( 'post', 'page', 'movie', 'book' ) ) ); ?>
    
        <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
        <!-- CUSTOM POST FORMATTING HERE -->
    
        <!-- POST START --><br/>
        <div class="post">
            <!-- ENTRY START -->
    		<div class="date">
    		    <p>Posted on <span style="font-weight: bold;"><?php the_time( 'D d M Y ' ); ?></span> (about  <?php echo human_time_diff( get_the_time('U'), current_time('timestamp') ) . ' ago'; ?>) by <span style="font-weight: bold;"><?php the_author_link(); ?></span></p>
    		</div>
            <div class="entry">
    			<h2 class="title"><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
    		</div>
            <!-- ENTRY END -->
    	</div>
        <!-- POST END -->
    
        <?php endwhile; ?>
    
        <?php if(($wp_query->found_posts) > (get_option('posts_per_page'))) :?>
    
        <!-- Page Navigation -->
        <?php if (function_exists('wp_pagenavi')) : ?>
        <div class="pagenavi">
            <?php wp_pagenavi(); ?>
        </div>
    
        <?php else : // Use WordPress default page navigation. ?>
    
        <div class="pages">
            <span class="older"><?php next_posts_link('&laquo; Older Entries'); ?></span>
            <span class="newer"><?php previous_posts_link('Newer Entries &raquo;'); ?></span>
        </div>
    
        <?php endif; ?>
    
        <?php endif; ?>
    
        <?php else : ?>
    
        <p>Sorry, but nothing matched your search criteria.</p>
    
    	<?php get_search_form(); ?>
    
        <?php endif; ?>
    
        </div> <!-- END main-content -->
    
        <?php get_footer(); ?>

    I tried it replacing the names of post types to my own, but… ;

    http://www.parabolastudio.com/

Viewing 15 replies - 1 through 15 (of 21 total)
  • The topic ‘How to Show All Post Types’ is closed to new replies.
Skip to toolbar