- This topic has 5 replies, 3 voices, and was last updated 5 years ago by
David.
-
AuthorPosts
-
January 2, 2020 at 1:19 am #1119561
Michael
Hi,
I previously used this code to move my category and tags to the top:
add_action( 'generate_after_entry_title', 'tu_add_meta_below_title' ); function tu_add_meta_below_title() { $categories_list = get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'generatepress' ) ); $categories_list = sprintf( '<span class="cat-links"><span class="screen-reader-text">%1$s </span>%2$s</span>', _x( 'Categories', 'Used before category names.', 'generatepress' ), $categories_list ); $tags_list = get_the_tag_list( '', _x( ', ', 'Used between list items, there is a space after the comma.', 'generatepress' ) ); $tags_list = sprintf( '<span class="tags-links"><span class="screen-reader-text">%1$s </span>%2$s</span>', esc_html_x( 'Tags', 'Used before tag names.', 'generatepress' ), $tags_list ); ?> <div class="entry-meta"> <?php echo $categories_list; ?> <?php echo $tags_list; ?> </div> <?php }
After the last Generate Press update, ONE of TWO sites that are set up almost the same way, lost the icons associated with the categories and tags and now they are on the same line at the top. The other site was unaffected. I deactivated all plugins except GP Premium and Code Snippets. Cleared Caches, Browers, etc. And it still is messed up. I can’t figure out why one site was affected and not the other.
The site with the problem is in the ULR section. The site that is working correctly is linked in the left side of the footer on that site.
January 2, 2020 at 10:06 am #1120121Tom
Lead DeveloperLead DeveloperHi there,
To bring the icons back and put them on their own lines, try this:
.entry-header .cat-links, .entry-header .tags-links { display: block; } .entry-header .cat-links:before, .entry-header .tags-links:before { display: inline-block; }
It’s also much easier to move those items to the top now. So instead of your code, try this:
add_filter( 'generate_header_entry_meta_items', function() { return array( 'categories', 'tags', 'date', 'author', ); } ); add_filter( 'generate_footer_entry_meta_items', function( $items ) { return array_diff( $items, [ 'categories', 'tags' ] ); } );
February 4, 2020 at 4:06 am #1153865Michael
Hi Tom, thanks for the reply. I’m just now implementing this.
The top code (putting them on their own lines) isn’t working. I’m getting this error from Code Snippets:
Don’t Panic
The code snippet you are trying to save produced a fatal error on line 1:syntax error, unexpected ‘.’, expecting end of file
The previous version of the snippet is unchanged, and the rest of this site should be functioning normally as before.Please use the back button in your browser to return to the previous page and try to fix the code error. If you prefer, you can close this page and discard the changes you just made. No changes will be made to this site.
February 4, 2020 at 5:17 am #1153936David
StaffCustomer SupportFebruary 4, 2020 at 5:07 pm #1154762Michael
Lol, I’m stupid. That worked. ๐
February 5, 2020 at 2:58 am #1155108David
StaffCustomer SupportBeen there ๐
Happy to be of help. -
AuthorPosts
- You must be logged in to reply to this topic.