Your cart is currently empty!
Homepage › Community Forums › Epik Theme Support › Copy Portfolio Page Setup for Custom Post Type Archive Page
Tagged: archive page, custom post type, portfolio
Hi there —
I looked through what I could find in the forums on dealing with custom post types and I thought I had this … but I just copied the portfolio template page and used that for a new archive page for my custom post type “Course” … so archive-course.php
My brain is fuzzy so the code is just swimming away from me – how would I copy the portfolio listing page to use for the archive, and then the custom post type archive? I’d like all archive pages to display in the same way as the portfolio page.
Where am I going wrong in trying to mimic the portfolio page template to use for the archive template set up?
That’s not going to be an easy solution with the Genesis Framework. It’s a little difficult when trying to do something like that with Genesis, as there will be a lot of code that needs to be created in order for something like that to happen with your site.
The Portfolio file is a template, so if you’re able to create or select a template you can choose that one, or you can copy and paste this template and rename it if you wanted to as well.
Hmmm – I tried to copy the template and rename it to archive-course.php – the name of the custom post type. I’m thinking maybe there were variables that I needed to change in order to use it in this way, but I’m just not sure.
I found a great way to create another basic archive page template I can put in for a custom post type – but just not positive how to rewrite the loop so I could replicate the look of the portfolio page, including the prettyphoto integration – which I really like!
Maybe someone else can weigh in? I really want to figure this out as I know I’ll want to do this again. 馃榾
Thanks for weighing in!
Kat
you can look at my post.
Basically I ditched genesis ();
and called the header and footer separately.
get_header();
get_footer();
I then added
do_action( ‘my_content_area’ ); between those two so:
get_header();
do_action( ‘my_content_area’ );
get_footer();
I went into the portfolio page copied it, pasted to a new php doc and started taking out what I didnt need including calls to remove things because I wasn’t using the genesis loop to begin with.
The biggest thing was adding the css to the portfolio loop from the style sheet.
// Add custom loop
function portfolio_loop() {
echo '<div class="content"><div class="wrap">';
$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
$include = genesis_get_option( 'epik_portfolio_cat' );
$exclude = genesis_get_option( 'epik_portfolio_cat_exclude' ) ? explode(',', str_replace(' ', '', genesis_get_option( 'epik_portfolio_cat_exclude' ))) : '';
$cf = genesis_get_custom_field( 'query_args' ); // Easter Egg
$args = array( 'cat' => $include, 'category__not_in' => $exclude, 'showposts' => genesis_get_option( 'epik_portfolio_cat_num' ), 'paged' => $paged);
$query_args = wp_parse_args($cf, $args);
genesis_custom_loop( $query_args );
}
echo '</div></div>';
Just the .content and .wrap the functions add the class for you.
Hope this Helps!
and ps *the do action call, I changed to my own hook my_content_area So, you will notice I kept some genesis structure for placement, but the added functions are hooked to my_content_area not the genesis. So if you follow you will see I hooked them to my own call not the theme/framework.