Is it possible to change the portfolio template single for a specific category?

Is it possible to change the portfolio template single for a specific category?

Hi Mauro,

Thanks for writing in!
unfortunately the feature you are looking for need custom Development which is out of our theme support scope.
Please take help from a developer to do this.

Thanks

I already developed it myself, but at least I can tell which file I have to copy to the child theme and modify it for the single portfolio?

Thank you

Hi Mauro,

Yes, this is possible through the child theme and use the in_category() function to filter the category.

Firstly, you will have to install and activate the child theme and login through FTP and go to wp-content/themes/x-child/framework/views/YOUR_STACK/ then add the file wp-single-x-portfolio.php to that directory.

Edit the file and place this code:

<?php

// =============================================================================
// VIEWS/INTEGRITY/WP-SINGLE-X-PORTFOLIO.PHP
// -----------------------------------------------------------------------------
// Single portfolio post output for Integrity.
// =============================================================================

?>

<?php get_header(); ?>
  
  <div class="x-container max width offset">
    <div class="x-main full" role="main">

      <?php while ( have_posts() ) : the_post(); ?>
        <?php if ( in_category('THE_CATEGORY_SLUG') ) { ?>
            <!-- Place all the contents here -->
        <?php } else { ?>
          <?php x_get_view( 'integrity', 'content', 'portfolio' ); ?>
          <?php x_get_view( 'global', '_comments-template' ); ?>
        <?php } ?>
      <?php endwhile; ?>

    </div>
  </div>

<?php get_footer(); ?>

Please change THE_CATEGORY_SLUG in the code to the slug of the category you want to customize and place all the contents after the <!-- Place all the contents here --> area.

Hope this helps you get started.

Cheers!

This view, which file does it belong to exactly?

<?php x_get_view( 'ethos', 'content', 'portfolio' ); ?>

thank you

RESOLVED!

Glad to hear you got it sorted, Mauro.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.