WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

what is the code i have to put in the modifyed 'page' post type template?

share|improve this question
It would be helpful if you could offer more details in your question. – MikeSchinkel Feb 10 '11 at 17:00
There's an example here: codex.wordpress.org/… – t31os Feb 10 '11 at 18:06

Easy: modify the query... (and add some comment on top to make a template out of this...)

$query_default = new WP_Query( array(
     'orderby'      => 'menu_order'
    ,'order'        => 'ASC'
    ,'post_type'    => 'custompost' // THIS IS WHAT YOU'RE SEARCHING FOR
    ,'post_status'  => 'publish'
) );
    if ( $query_default->have_posts() ) :

        while ( $query_default->have_posts() ) : $query_default->the_post();


    else : // else; no posts
        _e( 'Nothing published so far.', TEXTDOMAIN_CONSTANT );
    endif; // endif; have_posts();

share|improve this answer

If you look at the Custom Fields page on WordPress codex, you can see the functions for Custom fields.

The "Template Tags" are the functions you generally use on your template:

  • get_post_custom() - Returns a multidimensional array with all custom fields of a particular post or page.
  • get_post_custom_values() - This function is useful if you wish to access a custom field that is not unique, i.e. has more than 1 value associated with it
  • get_post_custom_keys() - Returns an array containing the keys of all custom fields of a particular post or page.

Follow the links to each function to see examples on how to use them.

UPDATE: Ok, now I understand. You should try to add as many details as possible in your question for us to understand. As kaiser says, you should create a loopand add 'post_type' => 'custompost' to get the posts from that custom type. You can use the get_posts() function for this too.

share|improve this answer
i'm afraid you don't understand me... i have a custom post type called "custompost" and i want to display them on a wordpress page named "examplename"... how should i edit the page.php template to show the posts from "custompost" custom post type the same way as index.php shows normal posts? – m3tsys Feb 10 '11 at 17:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.