Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

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

2 Answers 2

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();

        endwhile;

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

    wp_reset_query();
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

 
discard

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.