Display Custom Post Type

  • Chris


    I’m trying to do something real simple because I’ve never created and played with custom post types. I have one created, albeit very simple, called “cpt_jobs”. I have a couple test posts created and want to show them on a page that I’ve created and title “Job Postings.”

    I tried creating a template and copying the loop-single and also the loop-page code in it but I’m not having any luck.

    In the loop-page.php and loop-single.php code that I copied into my template, I inserted ‘cpt_jobs’ as shown below, but I don’t fully yet understand exactly what’s going on, but I know it’s something painfully obvious. Any help will be greatly appreciated.

    $post_type = get_post_type_object( get_post_type('cpt_jobs') );



    Try something like this:

    if ( 'cpt_jobs' == get_post_type() ){
    ... code to run if cpt_jobs post type...
    }elseif ( 'something_else' == get_post_type()){
    ... code to run if something_else post type...
    ... code to run if neither of above post types...

Viewing 2 posts - 1 through 2 (of 2 total)

  • You must be logged in to reply to this topic.
Graphene Themes Forum