Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1223684
    nkiconsult
    Participant

    Hi all,

    we use Integrity and Masonry Grid for the blog.

    There is a comma behind every category word on the page blog as well on category and tag archives. The comma is correctly if there’s a second category, but this second category gets a comma, too. We need a option like “Don’t show a comma after the last category.”, then it works for one and more than one category in the meta line.

    The comma seems to come from the theme and unfortunately not from the template, isn’t it? However, this topic https://community.theme.co/forums/topic/essential-grid-categories/ could help but I can’t find the window shown in the essential-grid screenshot.

    Thanks a lot!

    Regards
    Daniel

    #1223819
    Paul R
    Moderator

    Hi Daniel,

    Thanks for writing in! To assist you with this issue, we’ll first need you to provide us with your URL. This is to ensure that we can provide you with a tailored answer to your situation. Once you have provided us with your URL, we will be happy to assist you with everything.

    #1223822
    nkiconsult
    Participant

    Hi,

    I forgot that the comma is displayed on the blog post itself as well. It doesn’t look pretty and correct, isn’t?

    Best regards
    Daniel

    #1223990
    nkiconsult
    Participant
    This reply has been marked as private.
    #1224392
    Rad
    Moderator

    Hi there,

    Is it a custom code? It can only remove through its code. Example, this is the code responsible for that

    function x_integrity_entry_meta() {
    
        //
        // Author.
        //
    
        $author = sprintf( '<span><i class="x-icon-pencil" data-x-icon=""></i> %s</span>',
          get_the_author()
        );
    
        //
        // Date.
        //
    
        $date = sprintf( '<span><time class="entry-date" datetime="%1$s"><i class="x-icon-calendar" data-x-icon=""></i> %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 ) )
                                  . '"><i class="x-icon-bookmark" data-x-icon=""></i> '
                                  . $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 ) )
                                . '"><i class="x-icon-bookmark" data-x-icon=""></i> '
                                . $category->name
                                . '</a>'
                                . $separator;
          }
    
          $categories_list = sprintf( '<span>%s</span>',
            trim( $categories_output, $separator )
          );
        }
    
        //
        // Comments link.
        //
    
        if ( comments_open() ) {
    
          $title  = apply_filters( 'x_entry_meta_comments_title', get_the_title() );
          $link   = apply_filters( 'x_entry_meta_comments_link', get_comments_link() );
          $number = apply_filters( 'x_entry_meta_comments_number', get_comments_number() );
    
    	  $text = ( 0 === $number ) ? 'Leave a Comment' : sprintf( _n( '%s Comment', '%s Comments', $number, '__x__' ), $number );
    
    $comments = sprintf( '<span><a href="%1$s" title="%2$s" class="meta-comments"><i class="x-icon-comments" data-x-icon=""></i> %3$s</a></span>',
            esc_url( $link ),
            esc_attr( sprintf( __( 'Leave a comment on: &ldquo;%s&rdquo;', '__x__' ), $title ) ),
            $text
          );
    
        } else {
    
          $comments = '';
    
        }
    
        //
        // Output.
        //
    
        if ( x_does_not_need_entry_meta() ) {
          return;
        } else {
          printf( '<p class="p-meta">%1$s%2$s%3$s%4$s</p>',
            $author,
            $date,
            $categories_list,
            $comments
          );
        }
    
      }

    And the code that removes extra comma is already there

     $categories_list = sprintf( '<span>%s</span>',
            trim( $categories_output, $separator )
          );

    My question, do you have a category without a name/title? I could only verify it through FTP, please provide your FTP login credentials as well.

    Thanks!

    #1224546
    nkiconsult
    Participant
    This reply has been marked as private.
    #1224954
    Rue Nel
    Moderator

    Hello Daniel,

    Thank you for providing the information. It turns out that you have made some changes to the _content-post-header.php file in the child theme. The issue is this line 66:

    
    echo $categories_output;

    It should be :

    
    echo $categories_list;

    I went ahead and fixed it already for you. If you need anything else we can help you with, don’t hesitate to open another thread.

    Regards.

    #1225545
    nkiconsult
    Participant

    Hi all,

    wow, excellent and wonderful! 😉 We were researching and researching in VC and backend – although it’s so easy…

    Thank you very much, it’s was a great help. Top service!

    Regards
    Daniel

    #1225731
    Prasant Rai
    Moderator

    You are most welcome. 🙂

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