The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other Custom Post Types in WordPress

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #165040

    Hey guys,

    Quick question. I started getting into themeing in WordPress lately. I get a lot of what I’m doing but one area that’s still tricky is custom post types. I can register them in the my functions.php file and I get my added option to my admin bar, but when I try to pull them onto my homepage.php file, I don’t get what I’m after or nothing shows up at all. I know that this is a big area so I won’t ask anyone to tell me how to do it, but if somebody knows of a great link to start me out it’d be very appreciated. I tried numerous google searches and tested many snippets of code, but I still couldn’t get it to work so I thought I’d ask here. Any help is greatly appreciated as always guys. Thank you.

        // WP_Query arguments
        $args = array (
            'post_type' => 'YOUR-CUSTOM-TYPE-HERE',
        // The Query
        $the_query = new WP_Query( $args );
        // The Loop
        if ( $the_query->have_posts() ) {
                echo '<ul>';
            while ( $the_query->have_posts() ) {
                echo '<li>' . get_the_title() . '</li>';
                echo '</ul>';
        } else {
            // no posts found
        /* Restore original Post Data */

    Also see this:



Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Other’ is closed to new topics and replies.