How to display Tags

Sorry to bother you again!

I tried to display “Tags” in the grey box in each post (where author’s name, date,category, comments shows).
Would you tell me how to add it?

I really appreciate all your support…!

Add this code

         	<?php if( is_single() ) {
	             		$tag_list = get_the_tag_list( '', __( ', ', 'travelify' ) );
	             			if( !empty( $tag_list ) ) {
									?>
							<span class="tags">
								<?php echo $tag_list; ?>
							</span>
							<?php
								}
							} ?>

Right before

</div><!-- .entry-meta →

On line 284 in content-extensions.php file. This file is located in Theme folder - library - structure.

Hi Aigars,

Thank you for your reply. I added the code to content-extentions.php, but Tags didn’t appeared in the grey box.
Am I missing something?

Are you sure that you added it in travelify_theloop_for_single function on line 284 and not some other line because </div><!-- .entry-meta → is mentioned several times in that file.

Yes, there are five</div><!-- .entry-meta → line, and added Right before “line 281 (not line 284)” as that’s the closest one.

  • </div><!-- .entry-meta → are in line “151”,“281”,“465”,“577”,“691”.

Also you mentioned travelify_theloop_for_single, I’m not sure what it is, but when I search, there are three of them in the file. But they are all before “line 281”.

80 travelify_theloop_for_single();
243 if (!function_exists(‘travelify_theloop_for_single’)):
247 function travelify_theloop_for_single(){

I changed it to blog full post instead of having “Read More” button. Is there something to do with it?
Hope you understand what I explain here.
I really appreciate your time and support-

Line 281 should be the right one.

And function travelify_theloop_for_single in which you have to add this code starts at the line 243 all way down some 100 lines or so. It is a single function with loads of thing in the middle. This is where you should look.

This solution will work only on single post view. If you want to add it on blog view when full content is displayed then you should add the same code on line 694 (it might be different in your case since you already added few lines of code). Again right before </div><!-- .entry-meta →

Hi Aigars,

Thanks for explaining. I added the same code on line 701 (it’s the closest one to 694), but Tag didn’t appear in a box…

So now I added the code below to two places (on line 281 and 649 right before </div><!-- .entry-meta → ).
Is it correct? or should I add to only one place? Not sure why it doesn’t work…
*Also is it possible to add the Tag after Category and before the comment?

<?php if( is_single() ) {
$tag_list = get_the_tag_list( ‘’, __( ', ', ‘travelify’ ) );
if( !empty( $tag_list ) ) {
?>
<span class=“tags”>
<?php echo $tag_list; ?>
</span>
<?php
}
} ?>`

Hi Aigars,

So sorry to bother you again.
I’ve tried the above couple of times (and with different combo), but still Tag didn’t appear… It’d be great if you could let me know if you can think of anything why it doesn’t work.

I really appreciate your time

Update : I just realized that when I click each post, “the Tag” appear in a box.

Is it possible to display the Tag in Top page (without clicking each post)?

My site : style imported.net

Add the same code everywhere right before closing

</div><!-- .entry-meta →

It is located in several locations, for archive, search and other loops.

Ok, no I see why this was not working in the first place.

Instead of my above mentioned code use it like this:

	<?php
	             		$tag_list = get_the_tag_list( '', __( ', ', 'travelify' ) );

						if( !empty( $tag_list ) ) {
							?>
							<div class="tags">
								<?php echo $tag_list; ?>
							</div>
							<?php
						} ?>

Add it on the sample places. Previously it checked for is_single page, so it didn’t work in archive pages.

This CSS might help to add this tags in line with the rest of the entry-meta information. But it depends on how you can to use them.

.entry-meta .tags {
    display: inline;
}

Hi Aigars,
Thanks for your reply!

I added new code, but it still didn’t appear in a box.
It appears when I click each posts, but didn’t show in front page…

  • I added the same place you mentioned first reply.

Right before

</div><!-- .entry-meta →

On line 284 in content-extensions.php file. This file is located in Theme folder – library – structure.

It is not going to work because you are still dealing with a single post loop. You should add it on ALL loops where you want tags to appear such as archive, search, blog templates etc.