- This topic has 11 replies, 3 voices, and was last updated 2 years, 11 months ago by Tom.
December 21, 2017 at 9:27 pm #454963sampath
Hey, I am new to wordpress(php) development. I have purchased generatepress plugin recently. I was able to modify single posts page successfully to my requirement.
1. I have some meta data as custom fields for each post, I am trying to add this meta data to the posts on the home page instead of date, author, category meta data.
2. I also want to style or change the post format to my requirement. Does changing css will be enough and right way to do it?>
I am not able to find the right place to add it. look like post-meta.php is the right place but i need more help: whats the right way to add and where ?
Thanks in advanceGP Premium 1.5.6December 21, 2017 at 10:22 pm #454983TomLead DeveloperLead Developer
You can use this hook to add your custom PHP into the meta area: https://docs.generatepress.com/article/generate_after_entry_title/
As for the post format, the
<article>element has the post format as a class which you can use to apply your CSS.
Let me know if you need more info 🙂December 21, 2017 at 11:23 pm #454993sampath
hey thanks, overriding generate_post_meta function to add custom meta data to posts on homepage worked, but as soon as i enabled ‘blog’ from the GP plugin my changes are gone???December 22, 2017 at 9:36 am #455332TomLead DeveloperLead DeveloperDecember 22, 2017 at 11:17 am #455390sampath
Yeah, adding a new function to the hook works too!
Also, i found out why my meta data is not showing when i enable ‘blog’, its because i have unchecked ‘display post data, author, categories, tags’ and its hiding my custom meta data too with a css style – display: none.
How do I show my custom meta with the ‘blog’ activated from the GP Plugin.
I really appreciate your support Tom.December 22, 2017 at 6:59 pm #455601sampath
changing the div class name from entry-meta to someother class worked.
ThanksDecember 22, 2017 at 10:55 pm #455630TomLead DeveloperLead Developer
Glad you got it working! You can also just override that
display: noneCSS to
display: blockwith an !important or a more specific selector 🙂December 22, 2017 at 11:20 pm #455643sampath
When I add a css class to a div element I am seeing the same class in both homepage and single page.
Is there a way to apply css class only to homepage elements??
I was modifying ‘generate_post_classes’ and ‘generate_main_classes’ functions
ThanksDecember 23, 2017 at 8:00 am #455822LeoStaffCustomer SupportDecember 23, 2017 at 11:23 am #455910sampath
i am trying to add bootstrap column class to article element i.e ‘col-lg-4 col-sm-6 col-xs-6’ but they are being applied to both home posts and single posts page.
your solution might not be helpful in this case
edit: also i did not find any .home class already in there, did you mean to ‘add a new .home class to inside-article element and style it’?December 23, 2017 at 11:59 am #455916sampath
this helped me to know current view page https://wordpress.stackexchange.com/questions/83887/return-current-page-type and i added classes based on the ‘current view’
edit: or just ‘is_single()’ function.
thanksDecember 23, 2017 at 10:48 pm #456076
- You must be logged in to reply to this topic.