- This topic has 12 replies, 2 voices, and was last updated 1 year, 9 months ago by
Leo.
-
AuthorPosts
-
September 17, 2020 at 9:23 am #1447430
JUDE
I know there are lots of posts already about ACF and Generatepress, but I’ve not found one that answers my question. So, apologies if I’m going over ground that’s already been covered.
I have generated an ACF for posts in particular categories. In the admin section that’s fine – I can input the info I need.
My issue is how to output them at the other end. Usually I know this means editing the actual WP templates. Is there a different way to do this in Generatepress – I’ve been looking at Elements, and Hooks, and pasting in things like
{{custom_field.film-title}}
{{custom_field.film-director}}
but nothing displays.Do I have to edit the actual templates, or can Generatepress do some of the heavy lifting here?
September 17, 2020 at 10:07 am #1447489Leo
StaffCustomer SupportHi there,
If I understand this correctly, the hook element should be what you are looking for:
https://docs.generatepress.com/article/hooks-element-overview/You can add something like this to output it and make sure to check to execute PHP:
<?php $custom_field = get_post_meta( get_the_ID(), 'film-title', true ); echo $custom_field; ?>
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/September 17, 2020 at 10:15 am #1447507JUDE
Okay, thanks, that looks like a proper bit of code!
So – where do I generate the hook? Is it generate_after_main_content? Or somewhere else?
September 17, 2020 at 10:17 am #1447511Leo
StaffCustomer SupportThat depends where you want the custom field content to show:
https://docs.generatepress.com/article/hooks-visual-guide/Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/September 17, 2020 at 10:56 am #1447559JUDE
In the main body of the post.
September 17, 2020 at 10:58 am #1447562Leo
StaffCustomer SupportHave you taken a look at all the hooks here?
https://docs.generatepress.com/article/hooks-visual-guide/#single-postDocumentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/September 17, 2020 at 11:09 am #1447577JUDE
Based on that it’d be the generate_after_content hook.
I’m not seeing it though.
It’s not exactly a sing;e post. I want it to output to all posts in a certain category.
September 17, 2020 at 11:15 am #1447585JUDE
Execute Shortcodes and Execute PHP are also both checked.
September 17, 2020 at 11:17 am #1447590Leo
StaffCustomer SupportWhat are you not seeing?
It should be there for sure:
https://www.screencast.com/t/hqs8hyHgvI want it to output to all posts in a certain category.
You can use the display rules:
https://www.screencast.com/t/z2WUoWxlDocumentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/September 17, 2020 at 11:29 am #1447609JUDE
I am using the display rules.
It’s probably something really basic I’m getting wrong.
I’ve included all the relevant links in the Private Information section.September 17, 2020 at 2:02 pm #1447766Leo
StaffCustomer SupportI’m seeing
film-title
in element here:
https://www.screencast.com/t/ZgxIREWkyJbut
film_title
in ACF:
https://www.screencast.com/t/XmYARRqpOUgCan you make sure the name matches?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/September 17, 2020 at 3:13 pm #1447825JUDE
Oh goodness, that was it! Thank you.
September 17, 2020 at 3:15 pm #1447826Leo
StaffCustomer SupportNo problem 🙂
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.