Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1048325
    bedingfield
    Participant

    Hi there,

    I want tags to show on my single blog posts, just under my meta tags.

    See here: http://elyrunners.club/2016/04/03/wymondham-20/

    I saw this post for putting them in footer, but can they go where I request. Under date, author?

    https://community.theme.co/forums/topic/tags-not-showing-in-renew/

    I currently have this function for date format…

    // =============================================================================
    // OVERWRITE THEME POST PAGE DATE STRUCTURE
    // -----------------------------------------------------------------------------
    // Allows me to change date format to what I like.
    // =============================================================================
    
    function x_renew_entry_meta() {
    
      $author = sprintf( '<span>%s</span>',
        get_the_author()
      );
    
      $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( 'M j, Y' ) )
      );
    
      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 ( comments_open() ) {
        $title  = get_the_title();
        $link   = get_comments_link();
        $number = get_comments_number();
        if ( $number == 0 ) {
          $comments = sprintf( '<span><a href="%1$s" title="%2$s" class="meta-comments">%3$s</a></span>',
            esc_url( $link ),
            esc_attr( sprintf( __( 'Leave a comment on: &ldquo;%s&rdquo;', '__x__' ), $title ) ),
            __( 'Leave a Comment' , '__x__' )
          );
        } else if ( $number == 1 ) {
          $comments = sprintf( '<span><a href="%1$s" title="%2$s" class="meta-comments">%3$s</a></span>',
            esc_url( $link ),
            esc_attr( sprintf( __( 'Leave a comment on: &ldquo;%s&rdquo;', '__x__' ), $title ) ),
            $number . ' ' . __( 'Comment' , '__x__' )
          );
        } else {
          $comments = sprintf( '<span><a href="%1$s" title="%2$s" class="meta-comments">%3$s</a></span>',
            esc_url( $link ),
            esc_attr( sprintf( __( 'Leave a comment on: &ldquo;%s&rdquo;', '__x__' ), $title ) ),
            $number . ' ' . __( 'Comments' , '__x__' )
          );
        }
      } else {
        $comments = '';
      }
    
      if ( x_does_not_need_entry_meta() ) {
        return;
      } else {
        printf( '<p class="p-meta">%1$s%2$s%3$s</p>',      
          $date,
          $author,
          $comments
        );
      }
    
    }
    #1048372
    Christopher
    Moderator

    Hi there,

    Copy _content-post-header.php from framework/views/renew and put it in the same path inside child theme, replace existing code with following :

    <?php
    
    // =============================================================================
    // VIEWS/RENEW/_CONTENT-POST-HEADER.PHP
    // -----------------------------------------------------------------------------
    // Standard <header> output for various posts.
    // =============================================================================
    
    ?>
    
    <header class="entry-header">
      <?php if ( is_single() ) : ?>
      <h1 class="entry-title"><?php the_title(); ?></h1>
      <?php else : ?>
      <h2 class="entry-title">
        <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to: "%s"', '__x__' ), the_title_attribute( 'echo=0' ) ) ); ?>"><?php the_title(); ?></a>
      </h2>
      <?php endif; ?>
      <?php x_renew_entry_meta(); ?>
      <?php if ( has_tag() ) : ?>
        <?php echo get_the_tag_list( '<p><i class="x-icon-tags" data-x-icon=""></i> Tags: ', ', ', '</p>' ); ?>
    <?php endif; ?>
    </header>

    Hope it helps.

    #1048507
    bedingfield
    Participant

    Thank you.

    some additional questions. How do I remove the tags from the footer?

    Also, is it possible to have tags as an unordered list?

    #1048882
    Rue Nel
    Moderator

    Hello There,

    Thanks for the updates! I’ve checked one of your post here: http://elyrunners.club/2016/05/01/bere-pen-10k-tamar-peninsula-devon/

    It is now showing the tags underneath the title and I also do not see any tags at the footer. If you want to display it as an unordered lists, please find and update the lines of code and use this:

    
    <?php if ( has_tag() ) : ?>
        <?php echo get_the_tag_list( '<p><i class="x-icon-tags" data-x-icon=""></i> Tags:</p> <ul><li> ', '</li><li>', '</li></ul>' ); ?>
    <?php endif; ?>

    You can copy the raw code from here (http://pastebin.com/aMvSd68L) to preserve that unicode html entity or data-x-icon value.

    If you need anything else, please let us know.

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