• mania112

    (@mania112)


    Using the U-Design theme, I am trying to edit the php to remove metadata when using a post in category 2, this is what I have, and it doesn’t work:

    if( $category->term_id != 2 ) {
             echo '';
     }
      else
    
     if( $udesign_options['show_portfolio_postmetadata_author'] == 'yes' ) :
                                                printf( __('By %1$s on %2$s ', 'udesign'), '</span>'.udesign_get_the_author_page_link().'<span>', get_the_date() );
                                            else :
                                                printf( __('On %1$s ', 'udesign'), get_the_date() );
                                            endif; ?>

    please help!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Michael

    (@alchymyth)

    have you tried to use the conditional tag in_category()

    https://codex.www.ads-software.com/Function_Reference/in_category

    Thread Starter mania112

    (@mania112)

    Yeah i’ve read that link and tried to implement it.

    I’m afraid this is beyond the scope of my expertise.

    I need to say:

    If category 2, do not display postmetadata (including the entire div, so display:none; i guess).

    else, go ahead and show it all.

    Michael

    (@alchymyth)

    try this (it should at least no result in any syntax errors):

    if( !in_category( 2 ) {
    
     if( $udesign_options['show_portfolio_postmetadata_author'] == 'yes' ) :
                                                printf( __('By %1$s on %2$s ', 'udesign'), '</span>'.udesign_get_the_author_page_link().'<span>', get_the_date() );
                                            else :
                                                printf( __('On %1$s ', 'udesign'), get_the_date() );
                                            endif;
    }
    ?>

    if you still have problems with errors or so, please post the full code of the template, and explain in detail how “it doesn’t work”.

    it might also help, if you post a link to a post in category 2, or to the category archive of category 2.

    Thread Starter mania112

    (@mania112)

    As an update and with the help of U-Design support I finished with the following method

    I’ve installed the child theme and added this code:

    .postid-14 .postmetadata,
    
    .postid-14 p.nocomments {
    
     display:none;
    
    }
    
    .postid-14 #main-content .divider {display:none;}

    As I have only 6 posts that need this formatting, this will work fine. Thanks for your help.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘removing postmetadata for specific category’ is closed to new replies.