WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Custom posts types display in page.php (8 posts)

  1. dorian06
    Member
    Posted 4 years ago #

    I would really like that Custom Post Type acts like Pages!
    What I want to do is to display this Custom Posts in the page.php

    Any help?

  2. Spencer Finnell
    Member
    Posted 4 years ago #

    Why not just use pages then?

  3. dorian06
    Member
    Posted 4 years ago #

    Because is a huge site, and I would like to divide the admin panel in different sections in order to make it easy to add content. Also, I want to use Custom Post Types because when I define the post-type, I can easily add custom fields for each kind of post-type. It looks great! I don't know how could I do this with pages!

  4. Spencer Finnell
    Member
    Posted 4 years ago #

    Do you have the post type created already? Are you just wondering how to display the pages? If so, how do you want to display them?

  5. dorian06
    Member
    Posted 4 years ago #

    Its already created and its called 'product'.
    I want to display post_type = product in pages.php
    Also, Im trying to get the post ID, and if it's a 'page' works fine, but if post_type = product It doesn't work.

    global $wp_query;
    $thePostID = $wp_query->post->ID;
    $theParentID = $wp_query->post->post_parent;
    $thePostTitle = $wp_query->post->post_title;
    echo "$thePostID";
    echo "$theParentID";
  6. MichaelH
    Member
    Posted 4 years ago #

  7. dorian06
    Member
    Posted 4 years ago #

    Thanks Michael, in Custom Post, should I be able to select the template? Because I don't see the template attribute in my Custom Post Type (I can see it in normal pages).

  8. MichaelH
    Member
    Posted 4 years ago #

    No. You have to code the template to display the post type you want.

Topic Closed

This topic has been closed to new replies.

About this Topic