- This topic has 45 replies, 3 voices, and was last updated 4 years, 10 months ago by Leo.
-
AuthorPosts
-
June 20, 2019 at 7:00 pm #936450Randy
Sorry for the delay: I took a dinner break.
We’re further along, but not quite there yet. We have:
Posted June 17, 2019 Categories Kids/Teens, Military, Podcasts, Space, Work Leave a comment
when it used to be:
Posted June 17, 2019 in Categories Kids/Teens, Military, Podcasts, Space, Work
Leave a comment(adding “in” and the Comments link on a new line)
June 20, 2019 at 7:30 pm #936460LeoStaffCustomer SupportCan you try the edited CSS?
https://generatepress.com/forums/topic/category-list-at-top-of-post/page/2/#post-936425Let me know π
June 20, 2019 at 8:07 pm #936480RandyYes, that fixed the Comments part. How can we get “in” in there?
(Almost there! Thanks.)
June 20, 2019 at 8:19 pm #936492LeoStaffCustomer SupportSorry final update.
Update the snippet to this:
//Change the GeneratePress post meta function add_filter( 'generate_post_date_output', 'tu_categories_to_date' ); add_filter( 'generate_category_list_output', '__return_false' ); add_filter( 'generate_tag_list_output', '__return_false' ); add_filter( 'generate_show_comments', '__return_false' ); function tu_categories_to_date() { $time_string = '<time class="entry-date published" datetime="%1$s" itemprop="datePublished">%2$s</time>'; if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { $time_string = '<time class="updated" datetime="%3$s" itemprop="dateModified">%4$s</time>' . $time_string; } $time_string = sprintf( $time_string, esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ), esc_attr( get_the_modified_date( 'c' ) ), esc_html( get_the_modified_date() ) ); // If our date is enabled, show it. $time_string = sprintf( 'Posted <span class="posted-on">%s </span>', // WPCS: XSS ok, sanitization ok. $time_string ); $categories_list = get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'generatepress' ) ); $categories_list = sprintf( 'in <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>', _x( 'Tags', 'Used before tag names.', 'generatepress' ), $tags_list ); echo $time_string . $categories_list; if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) { echo '<span class="comments-link">'; comments_popup_link( __( 'Leave a comment', 'generatepress' ), __( '1 Comment', 'generatepress' ), __( '% Comments', 'generatepress' ) ); echo '</span>'; } }
And the CSS to this:
.entry-header .comments-link { display: block; }
I tested the code so it should all work π
June 20, 2019 at 8:30 pm #936505Randy“Should” being the operative word. π
The posted line looks perfect. But no Comments count/link.
June 20, 2019 at 8:39 pm #936510LeoStaffCustomer SupportOh wow my bad. Getting too late here.
Updated the snippet:
https://generatepress.com/forums/topic/category-list-at-top-of-post/page/3/#post-936492June 20, 2019 at 8:49 pm #936514RandyI feel your pain (getting late here too).
Just noticed the word “Posted” is not on the front of the date line.
No worries if you need to sleep on it first.
June 20, 2019 at 8:53 pm #936515LeoStaffCustomer SupportEdited the snippet again:
https://generatepress.com/forums/topic/category-list-at-top-of-post/page/3/#post-936492June 20, 2019 at 8:55 pm #936516RandyWoo hoo! Looks like everything is set.
Tell Tom not to break it again. π
Thanks, and have a good night.
June 21, 2019 at 8:56 am #937168LeoStaffCustomer SupportNo problem π
June 23, 2019 at 6:40 pm #939051RandyMe again.
See https://randysrandom.com/independence-day/
…another of my sites. This one uses Facebook comments, rather than WP’s, so I don’t need a Comments link. I’ve tried a few iterations of the ideas here to get:
Posted on 4 July 2017 in Holidays, Thinking, Wow
…but I haven’t cracked it yet. (It currently shows “Categories” but I don’t actually need that word.) This is in Posts, not Pages. TIA
June 23, 2019 at 7:19 pm #939066LeoStaffCustomer SupportDon’t actually see the word Category:
https://www.screencast.com/t/knZyvBrjvDj3Have you figured this out?
June 23, 2019 at 7:26 pm #939069RandyAll but the “in” part.
I’m using this code:
//Change the GeneratePress post meta function add_filter( 'generate_header_entry_meta_items', function() { return array( 'date', 'categories', ); } );
June 23, 2019 at 7:35 pm #939071LeoStaffCustomer SupportTry this CSS:
span.posted-on:after { content: " in"; }
June 24, 2019 at 9:31 am #939755RandyThanks, Leo, that fixed it.
-
AuthorPosts
- You must be logged in to reply to this topic.