- This topic has 45 replies, 3 voices, and was last updated 4 years, 10 months ago by Leo.
-
AuthorPosts
-
April 9, 2019 at 10:14 am #864279Randy
CSS worked fine, thanks.
The functions didn’t — apparently because of conflict with earlier meta modifications (upstream in this thread). Like can’t redeclare tu_categories_to_date, and then (when I remove the duplicate) other problems, like unexpected ‘=’ and unexpected ‘}’.
Here’s the current previous meta tweaks:
//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( '<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( '<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 ( ! is_single() && ! 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>'; } }
April 9, 2019 at 3:33 pm #864479TomLead DeveloperLead DeveloperYou’ll need to replace the previous function with that new one.
April 9, 2019 at 6:46 pm #864539RandyAh. I hope you didn’t hurt yourself rolling your eyes. π
Works fine, and when the tags icon came up, I was able to fix that — so I am learning!
Thanks, and all set.
April 10, 2019 at 9:02 am #865199TomLead DeveloperLead DeveloperGlad I could help! π
June 20, 2019 at 2:24 pm #936342RandyWell, something broke. :-/
I did do a little site work today: setting expires headers. Can’t see how that would affect this, though.
Example (from https://thisistrue.com/035-to-boldly-go/ ):
Posted June 17, 2019Categories Kids/Teens, Military, Podcasts, Space, WorkLeave a comment
…all in one line.
Previously, the “Categories” line and “Leave a comment” (or N Comments) were both on a new line. How can I get back there?
I don’t recall any recent work that “could have” an effect on this, but I can’t say for sure when it was last working right.
June 20, 2019 at 3:17 pm #936359LeoStaffCustomer SupportHi Randy,
I’m guessing you’ve updated to GeneratePress 2.3?
This is because we’ve added the post meta ordering filter in the latest theme update which required some tweaks if you are using custom function previously.
So you are wanting post date > categories > comment for entry meta right?
If so you can now replace the big function above with this one:
add_filter( 'generate_header_entry_meta_items', function() { return array( 'date', 'categories', 'comments-link', ); } );
Reference:
https://docs.generatepress.com/article/generate_header_entry_meta_items/
https://docs.generatepress.com/article/generate_footer_entry_meta_items/Let me know if you need more tweaks π
June 20, 2019 at 3:38 pm #936367RandyAh, but of course!
Problem with your replacement code, however:
“Your PHP code changes were rolled back due to an error on line 60 of file wp-content/themes/gp-child/functions.php. Please fix and try saving again.”
…where in my case line 60 is the one with “categories” in it, from above.
June 20, 2019 at 3:40 pm #936369LeoStaffCustomer SupportSorry. Missed some quotation marks.
Can you give it another shot?
https://generatepress.com/forums/topic/category-list-at-top-of-post/page/2/#post-936359June 20, 2019 at 3:46 pm #936371RandyI wondered about that — I noticed it was different in the third line, but thought maybe that was because it was the ending line.
OK, it’s now correct as “Posted in [category list]” … but the line under where it should say:
N Comments (which is a link to #comments) is not there. I DO have the Customizer > Layout > Blog > Display comment count box checked. (No change when I uncheck it.)
June 20, 2019 at 3:54 pm #936376LeoStaffCustomer SupportAhh wait…I think comment requires something different on single posts.
Will check with Tom and report back.
June 20, 2019 at 3:58 pm #936380LeoStaffCustomer SupportSorry Randy.
Comments still don’t work on single posts but we are definitely considering adding that in.
Can you revert back to the previous function and I’ll provide the necessary CSS?
Let me know π
June 20, 2019 at 4:17 pm #936387RandyCan I? Sure. The functions code and the CSS are upthread (Entries #574223 & #574243), if you need to look at them.
June 20, 2019 at 4:24 pm #936391LeoStaffCustomer SupportCan you add in the function first?
I just checked the page and still don’t see the comment link like before.
Let me know π
June 20, 2019 at 4:44 pm #936402RandyAh, now that I know what you meant, done!
June 20, 2019 at 6:12 pm #936425LeoStaffCustomer SupportTry this CSS:
.entry-header .comments-link { display: block; } .entry-meta .cat-links { padding-left: 3px; }
Let me know π
-
AuthorPosts
- You must be logged in to reply to this topic.