Tagged: x
-
AuthorPosts
-
November 13, 2016 at 11:35 am #1255352
Bastian AParticipantHi there,
I’m trying to hide the date for each post in my portfolio section, but instead I want it to show the category I specified for that post.
My Idea: copy the php template file responsible for that to my child-theme and modify it. But I’m a bit confused which to take and where to edit, as there are ‘template_layout_portfolio.php’, ‘wp-single-x-portfolio.php’, ‘_portfolio.php’ and ‘content_portfolio.php’.
Thanks in advance!
November 13, 2016 at 11:48 am #1255360
RupokMemberHi there,
It seems you are referring the “Recent Posts” element with post type ‘portfolio’ not the portfolio item. Would you point us that with URL?
Cheers!
November 13, 2016 at 12:21 pm #1255379
Bastian AParticipantOh, you are right!
That’s the recent-post element from cornerstone.
I used one of your demo contents and was mislead.Here is the url:
http://www.schimmel.kruell-architekten.de/wordpress/November 13, 2016 at 1:00 pm #1255398
RupokMemberHi there,
In that case you need to modify the Cornerstone element using functions. Unfortunately it would be out of our support scope. But you can follow this thread – https://community.theme.co/forums/topic/add-excerpt-to-recent-posts-shortcode/#post-66964
That’s the code you need to modify if you want to achieve this. The example was to add excerpt and you need to add category, that’s the difference.
Cheers!
November 15, 2016 at 8:47 am #1257978
Bastian AParticipantThanks Rupok,
I understand that this is out of support-scope. But maybe you can clarify a bit.
The thread you provided suggests to modify the shortcodes’ functionality.
So can I just add an attribute like so:function x_shortcode_recent_posts_v2code( $atts ) { extract( shortcode_atts( array( 'id' => '', 'class' => '', [...], 'enable_category' => '' ), $atts ) );set its values
$enable_category = ( $enable_excerpt == 'true' ) ? true : false;and include it in the $output ?
$output .= '<a href...>' [...] .( $enable_category ? '<span class="x-recent-posts-category">' . strip_tags( get_the_category() ) . '</span>' : '' ) . '</a>';I hope I got this right. Please correct me if not.
November 15, 2016 at 10:28 am #1258129
RupokMemberHi there,
Let’s try that. Yes you need to add the category to the output. Let’s see if it throws any error or work.
Cheers!
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1255352 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
