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.

I just created a custom post type "publication" with the slug "publications".

Now im stuck trying to view all the publications index in a URL like:

http://www.myExampleSite.com/publications

Do I have to create some custom layouts for it, and how it will be using an index clone of twentyten theme, maybe using get_template_part?

Thanks in advanced.

share|improve this question
    
I just tried publication.php (index.php clone) with get_template_part( 'loop','publication' ); and loop-publication.php (loop.php clone) but doest work. I get: Not Found –  José Pablo Orozco Marín Feb 7 '11 at 15:05

1 Answer 1

up vote 2 down vote accepted

In WordPress 3.1 virtual directory is created for you custom post type and so you don't really need to do anything but if you are on a earlier version then you will need to make a few step:

which you have done most but you will need to change loop-publication.php and add your custom post type to the query args or replace the loop with your custom loop that includes the custom post type in the args something like this:

<?php $loop = new WP_Query( array( 'post_type' => 'publication', 'posts_per_page' => 10 ) ); ?>

<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>

    <?php the_title( '<h2 class="entry-title"><a href="' . get_permalink() . '" title="' . the_title_attribute( 'echo=0' ) . '" rel="bookmark">', '</a></h2>' ); ?>

    <div class="entry-content">
        <?php the_content(); ?>
    </div>
<?php endwhile; ?>

now since you want to view the list on http://www.myExampleSite.com/publications add this code to the very top of your publications.php

<?php
/*
Template Name: publications
*/
?>

then create a page and change its slug to 'publications' and select publications as page template.

and you are set to go.

share|improve this answer
    
Works like a charm. Thank you. –  José Pablo Orozco Marín Feb 7 '11 at 15:49
    
And if only this custom type has a relation with a custom taxonomy (Publisher) with slug (myExampleSite.com/publisher) which will be the layout-clone structure? Thanks in advance. –  José Pablo Orozco Marín Feb 7 '11 at 15:53
    
create taxonomy-Publisher.php and you are done. –  Bainternet Feb 7 '11 at 16:03
    
Is custom taxonomy tag. Then I clone: tag.php to tag-publisher.php and change get_template_part( 'loop', 'tag' ); to get_template_part( 'loop', 'publisher' ); But im still getting Page not found. Thanks. –  José Pablo Orozco Marín Feb 7 '11 at 16:16
    
Nop that's no how it works you need to call it taxonomy-Publisher.php –  Bainternet Feb 7 '11 at 17:24

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.