Show categories in excerpt meta

Home Forums Spacious Pro Show categories in excerpt meta

This topic contains 3 replies, has 2 voices, and was last updated by  Bishal Napit 2 years, 3 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1298523

    Derek
    Participant

    Hi,

    Is there a way to display categories in the meta display of excerpts between the author name and read more button?

    #1298528

    Bishal Napit
    Moderator

    Hi, Derek.

    Please create a child theme and then in the ‘functions.php’ file of the child theme, copy the function spacious_entry_meta() from file ‘inc/functions.php'(line number 820-869) in it. Now, find the codes below:
    <span class="by-author author vcard"><a class="url fn n" href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>"><?php the_author(); ?></a></span> and:

    <?php if ( spacious_options('spacious_post_meta_category', 0) == 0 ) { ?>
    	<?php if( has_category() ) { ?>
    		<span class="category"><?php the_category(', '); ?></span>
    	<?php } ?>
    <?php } ?>

    Now, just move those above mentioned code just this below code and check:-

    <?php if( $spacious_show_readmore ) { ?>
    	<span class="read-more-link"><a class="read-more" href="<?php the_permalink(); ?>"><?php echo spacious_options( 'spacious_read_more_text', __( 'Read more', 'spacious' ) ); ?></a></span>
    <?php } ?>

    Hope this works.
    Thanks.

    #1298533

    Derek
    Participant

    Hi Bishal. I copied this into my child theme functions.php, but I got an error. What did I do wrong?

          <?php if( $spacious_show_readmore ) { ?>
          	<span class="read-more-link"><a class="read-more" href="<?php the_permalink(); ?>"><?php echo spacious_options( 'spacious_read_more_text', __( 'Read more', 'spacious' ) ); ?></a></span>
          <?php } ?>
    
       	<span class="by-author author vcard"><a class="url fn n" href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>"><?php the_author(); ?></a></span>
    
          <?php if ( spacious_options('spacious_post_meta_category', 0) == 0 ) { ?>
    	      <?php if( has_category() ) { ?>
    	         <span class="category"><?php the_category(', '); ?></span>
    	      <?php } ?>
          <?php } ?>
    
    }
    #1298595

    Bishal Napit
    Moderator

    Hi, Derek.

    You need to copy all the function code as mentioned above with line numbers and do the same as instructed, else it is not going to work. So, can you do the same and check? Thanks.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.