URL for custom post type using custompress

The usage guide is not very thorough when it comes to actually viewing and accessing content. The section on creating template pages needs a LOT more detail IMHO.

So. I have a custom post type called "program" and a taxonomy named "performance". Was able to create an archive page and get everything showing up. NOW, how to drill down and have JUST the "performance" category showing up on it's own page plus another sub-category under that? I tried creating a taxonomy-performance.php but no idea what URL is supposed to work or what that file should be... copy of single? copy of archive?

Totally lost and freaking out as it's a rush job that I'm supposed to deliver tomorrow.

Support Access granted.

http://performersion.berlin/program/
Sub-site of cre8tives using domain mapping called "performersion"

  • Michael Bissett
    • Recruit

    Hey peter_harris, Michael here! :slight_smile:

    From my own research here, category & taxonomy bases (i.e. /performance) aren't designed to be viewable, in of themselves (which seems weird :slight_frown: ).

    However, a way to work around this would be to instead create a page (which I've done for you), and then create a template for that style. In your case, you'd want to copy the archive.php template for your theme, and would want to have it named:

    page-performance.php

    And making your edits in that file.

    Kind Regards,
    Michael

  • peter_harris
    • Syntax Hero

    After a massive bucket load of chaos, I'm getting a bit closer to solving this.

    Where I finally ended up was deleting all of my top level taxonomies in favor of a single one that could have parent and child categories underneath. Works great for creating archives of single categories. But ONLY with the default archive file from my theme (which is FoundationPress). This creates a whole host of other problems. So I'm left as confused as ever, wondering how one is supposed to isolate content from categories within a custom post type.

  • peter_harris
    • Syntax Hero

    For instance, this works just great for regular posts:

    $args = array( 'posts_per_page' => 2, 'offset'=> 0, 'category' => 4 );

    And so does this:

    $args = array( 'posts_per_page' => -1, 'post_type' => 'homeboxes' );

    But THIS does NOT:

    $args = array( 'post_type' => 'program', 'posts_per_page' => 2, 'offset'=> 0, 'category' => 12,13 );

  • peter_harris
    • Syntax Hero

    Basically this is the code that works fine for normal posts:

    <?php			
    
    				$args = array( 'posts_per_page' => 2, 'offset'=> 0, 'category' => 4 );
    
    				$myposts = get_posts( $args );
    				foreach ( $myposts as $post ) : setup_postdata( $post ); ?>
    					<div class="small-12 medium-6 large-6 columns">
    						<div class="blogbox">
    						<div class="blogdate"><?php echo get_the_date(); ?></div>
    						<div class="blogcat"><a href="http://resonate.is/blog/">From the blog</a></div>
    						<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('large', array('class' => 'alignnone ftrdhome')); ?></a>
    						<a href="<?php the_permalink(); ?>"><h3><?php the_title(); ?></h3></a>
    						<?php the_excerpt(); ?>
    							<a href="<?php the_permalink(); ?>">MORE</a>
    						</div>
    					</div>
    				<?php endforeach;
    				wp_reset_postdata();?>

    And then an example that works fine targeting a custom post type called 'homeboxes':

    <?php			
    
    			$args = array( 'posts_per_page' => 1, 'post_type' => 'homeboxes','include' => '553' );
    
    			$myposts = get_posts( $args );
    			foreach ( $myposts as $post ) : setup_postdata( $post ); ?>
    
    <article id="post-<?php the_ID(); ?>" <?php post_class( 'post-' . $post->post_name ); ?>>
    		<div class="entry-content">
    		<h2><?php the_title(); ?></h2>
    		<p><?php echo do_shortcode('[ct id="_ct_textarea_5629141683f5b" property="title | description | value"]'); ?></p>
    	</div>
    <div class="bottombtn"><a href="#modal--<?php the_ID(); ?>" class="button"><?php echo do_shortcode('[ct id="_ct_text_562e097e03112" property="title | description | value"]'); ?></a></div>

    So the question is... why does
    'category' => 4
    work for regular posts and not custom posts? When I look at the custom taxonomy I can see ID numbers just like with posts, but for some reason it doesn't work. :slight_frown:

  • peter_harris
    • Syntax Hero

    More in depth explanations about setting up templates, how to target specific categories/taxonomies within a custom post type, etc. This is the area where I was stumbling in the dark. Unfortunately while there's a lot of info in the wordpress codex about custom post types, it's indecipherable by non-programmers.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.