SOS custom post type taxonomy page
-
I have searched the forums and google and spent a lot of time trying to figure this out. I have all the pieces but they are not working together at this point.
Here is what I want to do with my custom post type “presspieces” and its one taxonomy “publishers”. I need a category like list in the right sidebar but coded (not a widget) because I do not want to use the actual side bar as this menu is not to appear on the blog. With the titles of the taxonomy terms of “publishers” such as “New York Times” followed by nested ul’s of the posts tagged with the particular term. I have this menu generating fine and when the user clicks the individual post in each term of the taxonomy the single-presspiece.php template is accessed.
What I need is:
…to leave the post links the way they are but code the taxonomy term links to hit a taxonomy.php that will send them to a page that knows what taxonomy term they clicked and will display a page-able list (one post per page) of all the posts tagged with the appropriate term. Currently I can get the titles to hit a 404 page from mysite.com/press returning a path containing the slug like mysite,com/press/new-york-times/
The post links resolve correctly to mysite.com/presspiece/new-york-times-aricle-title(or permalink)
There was no category.php in my theme to start with. I tried to create a custom taxonomy page using the default category template from twentyten without success. But even if I could create a custom taxonomy.php page how do I get the links in the title to find the taxonomy.php? Theoretically if I could customize what page they hit I could create a page-term.php for each term and do it in an un-dynamic way though I was hoping to get it be one template that handles all term pages. It is being done with categories easily so I am hopeful I can get help to finish this. Custom Post Types are supposed to be pretty much the same as categories.I guess if I could not do the above I would settle for:
… that single-presspiece.php to act like a taxonomy.php or a category.php in that I want the single-presspiece.php doc to know what term_id the page that called it used and to display a page-able (one post per page) result of all the posts in the same taxonomy term, but on the page of the specific post that was clicked on on the previous menu.
My working example can be found here: https://64.207.152.179/press/
The code I am using to generate the menu is this:
<?php $myterms = get_terms('publisher', 'orderby=name&hide_empty'); ?>
<div style="border-bottom:1px solid #5d5d5d;margin:80px 0 5px;"></div>
<ul id="press-list">
<?php foreach ($myterms as $term) : ?>- slug; ?>"><?php echo $term->name; ?>
<?php $term_name = $term->slug;
$taxonomy = $term->taxonomy;
print_r ($myterms);
$args = array(
'post_type' => 'presspiece',
'taxonomy' => $taxonomy,
'term' => $term_name,
);
// assigning variables to the loop
global $wp_query;
$wp_query = new WP_Query($args);
//if ( $wp_query->have_posts() > 1) { ?>
<ul id="press-list-item">
<?php // starting loop posting only
while ($wp_query->have_posts()) : $wp_query->the_post(); ?> - - "><?php the_title(); ?>
<?php endwhile; ?>
<?php //} ?>
<div style="border-bottom:1px solid #5d5d5d;margin:5px 0;"></div>
<?php endforeach; ?> - slug; ?>"><?php echo $term->name; ?>
- The topic ‘SOS custom post type taxonomy page’ is closed to new replies.