Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1255352
    Bastian A
    Participant

    Hi 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!

    #1255360
    Rupok
    Member

    Hi 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!

    #1255379
    Bastian A
    Participant

    Oh, 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/

    #1255398
    Rupok
    Member

    Hi 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!

    #1257978
    Bastian A
    Participant

    Thanks 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.

    #1258129
    Rupok
    Member

    Hi 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!

  • <script> jQuery(function($){ $("#no-reply-1255352 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>