Alteration of portfolio layout Integrity / Include a featured post

Hi folks,

I want to alter the default integrity portfolio layout so that I can insert a link to a featured post.

I.E I have portfolio items which are acting as destinations, then posts which are acting as itineraries. I want to change the portfolio layout so as I can have one or more posts appear underneath the red social media buttons on the right hand side in empty space… possibly with some intro text or possibly just as a featured image.

Something similar to this site http://www.trufflepig.com/where-we-go/uganda/

You see how on the right hand side under “Uganda on the sounder” each of these four images is a featured image linking back to a post with the full article…

Any thoughts on what I can edit in order to accomplish this?

Thanks

Hi Stephen,

Thanks for writing in! Custom development is fall beyond our scope of the support. We can only provide a guideline for certain customizations.

To customize portfolio page, first you need to setup a child theme and activate it by following our guide here (https://theme.co/apex/forum/t/setup-how-to-setup-child-themes/57).

Then you can locate the file content-portfolio.php under your stack that you’re using. For example, if you’re using Integrity stack,
x/framework/views/integrity/content-portfolio.php

You can copy that file into your child theme’s respective location and then add your customizations accordingly.
x-child/framework/views/integrity/content-portfolio.php

Thanks!

Okay thanks that’s fine I understand. In that case could you elaborate to me about what the following two functions are doing:

x_get_option( ‘x_integrity_portfolio_archive_post_sharing_enable’ );
x_portfolio_item_project_link()

And where they are located within the framework structure?

Or even where they are located and I will figure it out for myself…

Thanks

Hello Stephen,

x_get_option( 'x_integrity_portfolio_archive_post_sharing_enable' );
x_portfolio_item_project_link();

Are PHP functions which is used in x/framework/views/integrity/content-portfolio.php. This will display the post sharing icons and the item links in the portfolio page.

If you want to insert a custom link in between the post sharing and item link, you will need to add your code in the x-child/framework/views/integrity/content-portfolio.php file:

<?php

// =============================================================================
// VIEWS/INTEGRITY/CONTENT-PORTFOLIO.PHP
// -----------------------------------------------------------------------------
// Portfolio post output for Integrity.
// =============================================================================

$archive_share = x_get_option( 'x_integrity_portfolio_archive_post_sharing_enable' );

?>

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  <div class="entry-featured">
    <?php x_portfolio_item_featured_content(); ?>
  </div>
  <div class="entry-wrap cf">

    <?php if ( x_is_portfolio_item() ) : ?>

      <div class="entry-info">
        <header class="entry-header">
          <h1 class="entry-title entry-title-portfolio"><?php the_title(); ?></h1>
          <?php x_integrity_entry_meta(); ?>
        </header>
        <?php x_get_view( 'global', '_content', 'the-content' ); ?>
      </div>
      <div class="entry-extra">
        <?php x_portfolio_item_tags(); ?>
        <?php x_portfolio_item_project_link(); ?>


        <!-- custom code here -->
        <p>Insert your link code here</p>
        <!-- custom code here -->



        <?php x_portfolio_item_social(); ?>
      </div>

    <?php else : ?>

      <header class="entry-header">
        <h2 class="entry-title entry-title-portfolio">
          <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to: "%s"', '__x__' ), the_title_attribute( 'echo=0' ) ) ); ?>"><?php x_the_alternate_title(); ?></a>
        </h2>
        <?php if ( $archive_share == '1' ) : ?>
          <?php x_portfolio_item_social(); ?>
        <?php endif; ?>
      </header>

    <?php endif; ?>

  </div>
</article>

Please note that custom coding is outside the scope of our support. Issues that might arise from the use of custom code and further enhancements should be directed to a third party developer.

We would love to know if this has worked for you. Thank you.

Okay great thanks,

ONE more question, can you point me in the direction of the functions which allow for standard posts to be displayed ordered by tag? I.E. a group of posts similar to the Portfolio arrangement etc… (hopefully that makes sense.

Thanks for all this folks, the support is great from you all

Hello Stephen,

Thanks for updating the thread. :slight_smile:

You can take a look at following tutorial:

https://nerodev.com/display-posts-tag-wordpress/

Thanks.

@RueNel

So I got it sorted in the end by commenting out the x_portfolio_item_project_link() call as I’ve instead decided I want multiple posts to appear all of whom have the same tag as the title slug. It might be a little hacky but it’s working.

        <?php //x_portfolio_item_project_link(); ?>
	<?php 
		
		$post_data_object = get_post(get_the_ID());
		 $itinerary_tag = $post_data_object->post_name;
		 $args = array(
			'posts_per_page' => '3',
			'order_by' => 'date', 
			'order' => 'ASC', 
			'tag' => $itinerary_tag //Each destination name has the same tag on it's respective itineraries so we can query based on that.
		 );
		 $tag_query = new WP_Query( $args );
		 if($tag_query->have_posts()) {
	?>
			<div class="x-entry-share man">
				<div class="x-share-options">
					<p>Have a look at some of our previous itineraries!</p>
	<?php
			while($tag_query->have_posts()) {
				$tag_query->the_post();
				$featured_image = get_the_post_thumbnail( get_the_ID(), 'full' );
				$permalink = get_post_permalink(get_the_ID());
				$title = get_the_title( get_the_ID());

	?>
				<p><a href="<?php echo $permalink; ?>" title="<?php echo $title; ?>" target="_blank"><?php echo $featured_image; ?></a></p>
	<?php

					
			}
	?>
				</div>
			</div>
	<?php
		 }
		// wp_reset_post_data();
		 
	?>
    <?php x_portfolio_item_social(); ?>

I now need to figure out a way of disabling the comment functionality on the individual post pages, can you or anyone else advise me on how to do this?

Thanks.

Hi Stephen,

Please check screenshots below.

Ah great I think I over engineered it a bit, I modded the functions.php fule in the child theme to include the following which I found somewhere on this forum:

//disable comments on posts

// Disable support for comments and trackbacks in post types
function df_disable_comments_post_types_support() {
$post_types = get_post_types();
foreach ($post_types as $post_type) {
	if(post_type_supports($post_type, 'comments')) {
		remove_post_type_support($post_type, 'comments');
		remove_post_type_support($post_type, 'trackbacks');
	}
}
}
add_action('admin_init', 'df_disable_comments_post_types_support');

// Close comments on the front-end
function df_disable_comments_status() {
return false;
}
add_filter('comments_open', 'df_disable_comments_status', 20, 2);
add_filter('pings_open', 'df_disable_comments_status', 20, 2);

// Hide existing comments
function df_disable_comments_hide_existing_comments($comments) {
$comments = array();
return $comments;
}
add_filter('comments_array', 'df_disable_comments_hide_existing_comments', 10, 2);

// Remove comments page in menu
function df_disable_comments_admin_menu() {
remove_menu_page('edit-comments.php');
}
add_action('admin_menu', 'df_disable_comments_admin_menu');

// Redirect any user trying to access comments page
function df_disable_comments_admin_menu_redirect() {
global $pagenow;
if ($pagenow === 'edit-comments.php') {
	wp_redirect(admin_url()); exit;
}
}
add_action('admin_init', 'df_disable_comments_admin_menu_redirect');

// Remove comments metabox from dashboard
function df_disable_comments_dashboard() {
remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal');
}
add_action('admin_init', 'df_disable_comments_dashboard');

// Remove comments links from admin bar
function df_disable_comments_admin_bar() {
if (is_admin_bar_showing()) {
	remove_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60);
}
}
add_action('init', 'df_disable_comments_admin_bar');

I’m just posting this here for the sake of completeness here in case someone has any issues similar to this in the future!

You can consider this issue closed, thanks for all the help!

Glad you were able to figure it out and thank you for sharing your code with other members :slight_smile:

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