Home › Forums › SEA WordPress Theme › Displaying Tags on Portfolio grid
- This topic has 6 replies, 2 voices, and was last updated 6 years, 1 month ago by
lew-egr.
-
AuthorPosts
-
April 20, 2020 at 11:47 am #20994
Hi. I would like to assign tags to portfolio projects. I can get the tag input panel to display in the admin, and assign tags to projects using the following code snippet in functions.php:
/* Add tags to portfolio backend*/ function reg_tag() { register_taxonomy_for_object_type('post_tag', 'ux-portfolio'); } add_action('init', 'reg_tag');and using:
$posttags = get_the_tags(); if ($posttags) { foreach($posttags as $tag) { echo $tag->name . ' '; } }to display them on the front end.
But what i can’t do is insert them where i would like, and assigned to each project.
My portfolio grid displays the featured image, with title, category and date beneath. I would like to display tags beneath the date.
Looking at the files – plugins/bm-builder/include/templates/modules/module-grid.php is where i need to add the code (below line 665?), but i need help in formating it correctly.
Can anyone help?
Many thanks
April 21, 2020 at 1:37 am #21001Hi,
Could you please leave your Portfolio grid page URL? I need to know what’s the layout.
ps: if you change the php file in the plugin, it will be covered after plugin update.Regards!
SeaTheme – SeaTheme.net – Twitter – Facebook
April 21, 2020 at 7:21 am #21003This reply has been marked as private.April 22, 2020 at 7:51 am #21019Hi,
Thanks for the information.
Looking at the files – plugins/bm-builder/include/templates/modules/module-grid.php is where i need to add the code (below line 665?), but i need help in formating it correctly.
Yes, it is correct.
I added it on this file https://www.dropbox.com/s/yqa282s1e8e90sn/qq20200422-154956.jpg?dl=0Besta
April 22, 2020 at 12:27 pm #21023Hi, that works great thank you. One thing i should have specified was that i would like to display them in an unordered list so each tag can be individually styled (within a bordered box with margin between).
I’ve tried all sorts of permutations from here https://developer.wordpress.org/reference/functions/the_tags/ but had no luck
Thanks again.
April 22, 2020 at 1:28 pm #21024Hi,
Welcome
It is a deep custom job. It is not included in the free support. I can only give you the basic suggestion.Regards!
SeaTheme – SeaTheme.net – Twitter – Facebook
April 22, 2020 at 3:09 pm #21031Hi. No problem. Got it working in the end using:
$posttags = get_the_tags(); if ($posttags) { $html.= '<div class="grid-item-date"><ul class="tag-list">'; foreach($posttags as $tag) { $html.= '<li>'.$tag->name.'</li>'; } $html.= '</ul></div>'; }and some CSS.
Thanks again
-
AuthorPosts
- You must be logged in to reply to this topic.
