- This topic has 10 replies, 4 voices, and was last updated 4 years, 3 months ago by Hans Kristian.
October 10, 2016 at 2:45 pm #234133Janet Davis
In my posts I want the tag and category to be at the top of the post next to each other, above the author and date.
I have the posts there but not the category. I used the following php in the hook before content but can not get the category to be there as well. Any help is greatly appreciated. Thank you Jan
$tags_list = get_the_tag_list( ‘<span class=”tag-links”><i class=”fa fa-tags”></i>’, __( ‘, ‘, ‘colornews’ ), ‘</span>’ );
if ( $tags_list ) echo $tags_list;
$category_list = get_the_category_list( ‘<span class=”category-links”><i class=”fa fa-categories”></i>’, __( ‘, ‘, ‘colornews’ ), ‘</span>’ );
if ( $category_list ) echo $category_list;
?>October 10, 2016 at 7:45 pm #234175TomLead DeveloperLead Developer
This function might help: https://gist.github.com/generatepress/c25f5fad1f646ef5eea3
You can see the block that says:
// Show category and tags
You can move that block above the date and author blocks.
Let me know if you need more info 🙂October 11, 2016 at 6:53 am #234306Janet Davis
I used the generate simple PHP method.
I copied the code directly into simple php to see the look.
The category shows up, but the tag doesn’t. Is it possible to get both?
This link has both attached to the post, but only the category shows up.
Is there documentation on when to use simple php and when to use the hooks.
JanOctober 11, 2016 at 7:25 am #234323TomLead DeveloperLead Developer
The tags will but only if they exist – the code is there so I don’t see any reason why they wouldn’t show up.
When overwriting functions or adding functions to hooks that don’t exist in GP Hooks, we use Simple PHP (or one of the other methods).
GP Hooks is good for inserting HTML/PHP etc.. not so much overwriting existing functions.October 11, 2016 at 10:39 am #234375Janet Davis
And thanks for the explanation!!!
JanOctober 11, 2016 at 12:30 pm #234439TomLead DeveloperLead DeveloperAugust 14, 2017 at 5:45 pm #365962Hans Kristian
The link to Github doesn’t work anymore. Can you please update it?
I also want to move the category and tags to the top 🙂August 14, 2017 at 6:36 pm #365993LeoStaffCustomer SupportAugust 14, 2017 at 6:53 pm #365999Hans Kristian
Yes please 🙂August 15, 2017 at 12:12 am #366122TomLead DeveloperLead Developer
You could try this: https://gist.github.com/generatepress/b3c574437f49c1fd26f4d6e9a3a6af55
Let me know 🙂August 15, 2017 at 5:03 am #366277Hans Kristian
- You must be logged in to reply to this topic.