Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1214314
    SirRahikkala
    Participant

    Hey

    I have Icon stack in use and blog has the masonry layout. However the post meta shows only the date, nothing else. I need to show also category. In masonry grid as well in the post itself.

    Child theme also in use.

    #1214464
    Christian
    Moderator

    Hey there,

    Please add the code below in your functions.php

    // Custom Icon Entry Meta
    
    function x_icon_entry_meta() {
    
    $date = sprintf( '<span><time class="entry-date" datetime="%1$s">%2$s</time></span>',
      esc_attr( get_the_date( 'c' ) ),
      esc_html( get_the_date() )
    );
    
    //
    // Categories.
    //
    
    if ( get_post_type() == 'x-portfolio' ) {
      if ( has_term( '', 'portfolio-category', NULL ) ) {
        $categories        = get_the_terms( get_the_ID(), 'portfolio-category' );
        $separator         = ', ';
        $categories_output = '';
        foreach ( $categories as $category ) {
          $categories_output .= '<a href="'
                              . get_term_link( $category->slug, 'portfolio-category' )
                              . '" title="'
                              . esc_attr( sprintf( __( "View all posts in: &ldquo;%s&rdquo;", '__x__' ), $category->name ) )
                              . '"> '
                              . $category->name
                              . '</a>'
                              . $separator;
        }
    
        $categories_list = sprintf( '<span>%s</span>',
          trim( $categories_output, $separator )
        );
      } else {
        $categories_list = '';
      }
    } else {
      $categories        = get_the_category();
      $separator         = ', ';
      $categories_output = '';
      foreach ( $categories as $category ) {
        $categories_output .= '<a href="'
                            . get_category_link( $category->term_id )
                            . '" title="'
                            . esc_attr( sprintf( __( "View all posts in: &ldquo;%s&rdquo;", '__x__' ), $category->name ) )
                            . '">'
                            . $category->name
                            . '</a>'
                            . $separator;
      }
    
      $categories_list = sprintf( '<span>%s</span>',
        trim( $categories_output, $separator )
      );
    }
    
    if ( x_does_not_need_entry_meta() ) {
      return;
    } else {
      printf( '<p class="p-meta">%1$s%2$s</p>',
        $date,
        $categories_list
      );
    }
    
    }

    Hope that helps. 🙂

    #1214513
    SirRahikkala
    Participant

    It worked fine. I have one more question so lets not make more threads.

    I have removed the sidebar from the search results page but it leaves padding-right 250px which is also defined at customizer as sidebar width. I would like to remove that padding-right but only from search results page. If I remove it from customizer sidebar width, the sidebar overlaps the blog page.

    I am using this to remove the sidebar:

    .search .x-colophon, .search .x-sidebar {
      display: none;
    }
    
    .search .x-main {
      width: 100%;
      
    }
    #1214813
    Rupok
    Member

    Hi there,

    Can you provide your URL if you still face this?

    Thanks!

    #1214898
    SirRahikkala
    Participant
    This reply has been marked as private.
    #1215256
    Nabeel A
    Moderator

    Hi again,

    Please add the following code in your Customizer via Appearance > Customize > Custom > Edit Global CSS:

    body.search.x-content-sidebar-active {
        padding-right: 0 !important;
    }

    Let us know how this goes!

    #1215757
    SirRahikkala
    Participant

    Thank you!

    #1215783
    Rupok
    Member

    You are welcome. Have a nice day! 🙂

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