Add paragraph description for the Portfolio page in Pro (Renew stack)

I would like to add a paragraph description for the Portfolio page in Pro. I am using the Renew stack.

I found a thread where someone did this in X-Theme and I tried to the supplied code but it did not work for Pro. Here is the thread: Adding a paragraph description for the Portfolio page

Thank you for your assistance.

Hello Patrick,

Thanks for writing in!

The given code only works for the Portfolio post type archive:

add_action( 'x_before_view_global__index', 'portfolio_short_desc' );
function portfolio_short_desc() {
	if(is_post_type_archive( 'x-portfolio' )){
		echo "<p>Short Description</p>";
	}
}

To make this work in the portfolio page, you will have to replace is_post_type_archive( 'x-portfolio' ) with is_page_template( 'template-layout-portfolio.php' ) therefore the final code would be:

add_action( 'x_before_view_global__index', 'portfolio_short_desc' );
function portfolio_short_desc() {
	if( is_page_template( 'template-layout-portfolio.php' ) ){
		echo "<p>Short Description</p>";
	}
}

Please note that the code provided above serves as a guide only and is to help you in getting started so implementing it and maintaining the code will be out of our support scope and for further maintenance for new possible versions of the theme that may cause the customization to break, you will need to hire a developer.

Notice: 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.

Best Regards.

Thank you Ruenel for your reply and supplied code. I did add it to my Pro child theme to functions.php and nothing happened. It saved and I refreshed the browser but I didn’t see any changes to the Pro portfolio page.

Hey Patrick,

The code I gave in my response will only work in Portfolio page or any page that uses the Layout - Portfolio page template. It does not work because your portfolio page is not using the page template. You must have a normal page serving as your portfolio page. Please the URL of your portfolio page so that we can confirm that this is your case and we can advise what can be done for your modifications.

Regards.

Thanks for your reply Ruenel.

I currently have the index page set as my portfolio page. I just changed the index page to a different page to see if it made any difference and it did not. Here is the portfolio page link https://redoxreviews.com/portfolio/

I checked the page attributes and it is selected as seen in the screenshot.

portfolio-page-attributes

Hey Patrick,

I now see the issue in the code. Please have it updated and use this instead:

add_action( 'x_before_view_global__portfolio', 'portfolio_short_desc' );
function portfolio_short_desc() {
	if( is_page_template( 'template-layout-portfolio.php' ) ){
		echo "<p>Short Description</p>";
	}
}

Best Regards.

Hey Ruenel, that worked perfectly! Is there a possibility of adding a hyperlink into the “Short Description” so that users can click over to my registration page?

Hey Patrick,

Simple update the code and use this:

add_action( 'x_before_view_global__portfolio', 'portfolio_short_desc' );
function portfolio_short_desc() {
	if( is_page_template( 'template-layout-portfolio.php' ) ){ ?>

		<p>Short Description and add your html link here.</p>
                

	<?php }
}

I modified the code above so that you can easily insert any HTML coding like a link to a particular page. To learn more about how you can create a link, please check this out:

Hope this helps.

1 Like

Hey Ruenel, it worked perfectly! Thank you so much for being so helpful! You are much appreciated.

Glad it’s working, and you’re most welcome!

1 Like

I looked in the forum for the answer to other questions I have but did not find an answer. Since this thread is about portfolio page customization I hope it is okay to ask here.

Is it possible to have portfolio items open in a new window?

Hi Patrick,

Yes, that is possible with the jQuery’s .attr() function.

https://api.jquery.com/attr/#attr2

The attribute you want to add is called target and its value would be _blank

https://www.w3schools.com/tags/att_a_target.asp

If you have a follow-up question, please write it on a new thread, as this one is getting longer and hard to follow.

Cheers!

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