- This topic has 21 replies, 3 voices, and was last updated 4 years ago by Tom.
-
AuthorPosts
-
February 28, 2020 at 8:34 am #1179840Anas
Hi π
I have two questions:
1. Is there a way to 1) add the time (HH:HH AM/PM) to the entry meta, 2) use the abbreviation of the month (FEB instead of February for example), 3) add the comments count next to the date? so the entry meta would look like this: https://imgur.com/a/3P5Oqht
2. How can I change the width of the entry-header so it would be the same as the width of the featured image?
Here’s how my entry-header looks like: https://imgur.com/oZkQ7ly and here’s how I want it to look: https://imgur.com/hh54SoYFebruary 28, 2020 at 11:58 pm #1180255TomLead DeveloperLead DeveloperHi there,
1. You can change the date and time format in “Settings > General”.
2. To add the comments count to the top entry meta, try this:
add_filter( 'generate_header_entry_meta_items', function( $items ) { $items[] = 'comments-link'; return $items; } ); add_filter( 'generate_footer_entry_meta_items', function( $items ) { return array_diff( $items, [ 'comments-link' ] ); } );
3. Try checking the “Display padding around images” option in Customize > Layout > Blog.
Let me know π
February 29, 2020 at 12:18 pm #1180826AnasHey Tom,
It worked thanks! However, regarding your 3rd answer, I tried the “Display padding around images” option, but it didn’t perfectly work.
Here’s how the posts look like without the padding around images: https://imgur.com/a/LkwzJHn and here’s how they look with the padding: https://imgur.com/a/2revADfAfter applying the “Display padding around images”, the image size got smaller. I want to keep the same image size but increase the entry-header’s width to fit the image width π
March 1, 2020 at 1:29 am #1181086TomLead DeveloperLead DeveloperCan you possible check the padding around images option and leave it saved so I can check out the CSS?
Have you tried decreasing “Separating space” option in Customize > Layout > Container?
March 1, 2020 at 5:20 am #1181220AnasYes. I tried decreasing “separating space” option, but the image is still wider than the the entry-header even though the separating space is 0px. Here’s how the posts look like with 0px separating space: https://imgur.com/zFAcBVc
I set the separating space back to 40px and checked the padding around images option.
March 2, 2020 at 12:16 am #1181912TomLead DeveloperLead DeveloperTry adding this CSS:
.generate-columns .inside-article { padding: 0; }
March 2, 2020 at 3:13 am #1182027AnasI appreciate it Tom! Now, it works perfectly on desktop (using your last CSS code and checking the “display padding around images” option ): https://imgur.com/p6Bi0wG
However, here’s how it looks on mobile: https://imgur.com/XjqIhRy
Here’s how it looks on mobile without the CSS code but “display padding around images” is checked: https://imgur.com/MJlQbmPMarch 2, 2020 at 6:30 am #1182174DavidStaffCustomer SupportHi there,
not sure how you want it to look on mobile, but try this CSS instead:
@media (min-width: 768px) { .generate-columns .inside-article { padding: 0; } }
This will only remove the padding on desktop
March 2, 2020 at 6:50 am #1182350AnasHey David,
Thanks for the reply!
The desktop version is working perfectly (I used Tom’s CSS code and checked the “display padding around images” option). So I don’t want to edit the desktop version.
However, the mobile version looks strange (https://imgur.com/XjqIhRy). As you can see, the picture/title are as wide as the screen itself!
I want the post-image/entry-header to look like this: https://imgur.com/MJlQbmP (That’s the result I get for the mobile version by just checking the “display padding around images” option )So using the CSS code and the padding option works just for the desktop version and using the padding option works just for the mobile version. Is there a way to apply style only for mobile device?
March 2, 2020 at 7:00 am #1182371DavidStaffCustomer SupportIf you simply replace the code Tom provided with the code i gave you here then that will do exactly what you require.
March 2, 2020 at 7:09 am #1182385AnasThanks! It finally worked!
March 2, 2020 at 9:27 am #1182533DavidStaffCustomer SupportGlad we could be of help
April 16, 2020 at 8:04 am #1241698AnasHey Tom,
The PHP code you provided in post #1180255, to add the comments count to the top entry meta, works perfectly. However, I couldn’t change the default ‘Leave a comment’ text.
Here’s how it looks when a post has no comments: https://imgur.com/a/9Y8t7R8
Here’s how it looks when a post has X comments: https://imgur.com/a/DWISpQOI tried the generate_leave_comment filter to get rid of the default text and show ‘0 comments’ when there aren’t any comments yet but David told me that the filter only works with the default WordPress Comments form. I hope you guys can find a solution in the future so the generate_leave_comment filter works with other comments’ plugins.
April 16, 2020 at 3:39 pm #1242205TomLead DeveloperLead DeveloperHi there,
Does this work?:
add_filter( 'gettext', function( $text, $original, $domain ) { if ( 'Leave a comment' === $text && 'generatepress' === $domain ) { return '0 Comments'; } return $text; }, 10, 3 );
April 17, 2020 at 12:26 pm #1243409AnasHi Tom,
After I addeed this code my website crashed completely! I can’t even access the WP admin dashboard
-
AuthorPosts
- You must be logged in to reply to this topic.