• Hi Anders,

    thank you for providing this excellent theme. My query relates to portfolio support in the Chaplin theme.

    I am currently using a basic plugin (Portfolio Post Type) that, obviously, creates a portfolio post type and outputs that post type.

    When I activate the Chaplin theme, for the portfolio post type I do not see the various post templates that are available for the normal post type (e.g. cover template, full-width etc).

    Is there a specific line in the functions file (or in the Chaplin theme template files) that I need to edit to ensure that custom post templates are available for the portfolio posts?

    Or would I need to create specific template parts for portfolio posts (e.g. content-meta-portfolio.php, content-portfolio.php, single-portfolio.php, template-cover-portfolio.php?)

    Or would you recommend that that I use another plugin such as Jetpack to generate portfolios using this theme?

    Tack!

    David

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter daveydreamnation

    (@daveydreamnation)

    Okay so I worked out how to make the custom post templates available for portfolio posts.

    I edited the individual template files within the Chaplin theme. For example, for the Chaplin: Cover Template Page Template (template-cover.php), I added ‘portfolio’ to the list of post types at the top of the file:

    /*
    Template Name: Cover Template
    Template Post Type: post, page, portfolio
    */

    And repeated for the other post templates.

    So that’s great, but I am still not sure how to add custom metadata for the portfolio posts. Is there a specific template part where I can do that?

    Thanks in advance …

    David

    You really do not want to be editing the Chaplin theme, your changes will be lost when it is updated. This is the reason to do mods as a child theme.

    I’m doing this for a project where I have one custom post type and three custom taxonomies. It takes some code lifting to do! I am not sure I can get everything in. If you look in functions.php you will find the meta data constructor function chaplin_get_post_meta. It looks like he has hooks in where you could add in a child theme functions.php functions to add post_meta data:

    // Allow output of additional meta items to be added by child themes and plugins
    do_action( 'chaplin_start_of_post_meta_list', $post_meta, $post_id );

    I ended up copying the entire chaplin_get_post_meta function to my functions.php and changed it to be toolkit_get_post_meta, and from there I added my own extra code for doing my metadata, e,g,

    // Module Taxonomy
    if ( in_array( 'module', $post_meta ) && has_term( '', 'module', $post_id ) ) : 
    	$has_meta = true;
    	?>
    	<li class="post-jetpack-portfolio-type meta-wrapper">
    		<span class="meta-icon">
    			<span class="screen-reader-text"><?php esc_html_e( 'Modules', 'chaplin' ); ?></span>
    			<?php chaplin_the_theme_svg( 'bookmark' ); ?>
    		</span>
    		<span class="meta-text">
    			<?php the_terms( $post_id, 'module', __( 'Module: ', 'chaplin' ) . ' ', ', ' ); ?>
    		</span>
    	</li>
    	<?php
    endif;

    This means in my templates that I made a copy of content.php changed to content-tool.php for my CPT, and call me own metadata function from there

    toolkit_the_post_meta( $post->ID, 'single-top' );

    It took even more legwork to get the archives working… You might go with JetPack since there is built in support for that, but I loathe the JetPack stuff.

    Thread Starter daveydreamnation

    (@daveydreamnation)

    Hi @cogdog and thanks for your reply. I can see from your other post that you’ve been wrestling with similar issues!

    You are right regarding the child theme, I actually went and created one shortly after writing my original post.

    Thanks also for sharing your code for a custom post-meta function … I will give it a go and see if it works!

    I agree re Jetpack, am trying everything possible to avoid using it. But I guess for others it might be a useful option.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Portfolio post types and Chaplin’ is closed to new replies.