-1

i created a custom_post_type and created a post in there and it does not appear in my web page...

how can i call it to where i want?

normal post are called like this:

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <h1 class="title"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1>
    <div id="content-align">
    <?php the_content(); ?>
2
  • 1
    Well... where do you want it? – s_ha_dum Feb 25 '13 at 16:19
  • i wanted it in index – Andre2894 Feb 25 '13 at 16:19
0

It sounds like you want to hook into pre_get_posts for the blog index. The following should only effect the blog index. That is what is_home() is for. Of course, you can edit the function to alter that behavior if you want.

function add_post_type_to_index_wpse_88317($qry) {
  if (is_home()) {
    $qry->set('post_type',array('post','movies_cp')); // plus any others you want.
  }
}
add_action('pre_get_posts','add_post_type_to_index_wpse_88317');

That post type is from another question on this site somewhere. I used it because I could test it on my server. You will need to make that match the name you used to register your post type.

Reference:

http://codex.wordpress.org/Class_Reference/WP_Query

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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