I’m a web developer by profession, and recently joined an club that has an atrocious website. Took the role of website manager and am trying to redo / redesign their website and decided to use WordPress, so that I could take the approach of not fully doing everything in code and using some theme editor and plugins so that other non-technical people in the club would be able to still make updates etc at a later point.
I’ve gone ahead and installed Advanced Custom Fields as a way to organize some items that we have and created custom posts, this way non-tech people can easily update data by interacting with a form. However, what I’m struggling with is how to display these posts the right way. I’m aware of a fully plugin approach like Elementor Pro, but I’m wondering what the options are to do this without plugins.
The base theme I’m using is Twenty Twenty-Four which is a FSE theme and they don’t seem to have a single.php or other php files to write php code in. When I do create my own php files they don’t seem to take effect. Any pointers on how to display these custom post types without plugins?
[ad_2]
Why not use a plugin ? They are very cheap. ? Is 10 hours of your time worth more or less than about $80 ?
What does the website do ?
What data is displayed ?
What is it supposed to do ?
How should it work ?
What do you need to display ?
Is it a blog type website ?
What data do they need to update ?
Why do you want them to use a form to update data.
Also starting off with ACF off the bat, is not the simplest solution.
The documentation in ACF gives you examples of how to integrate them directly on the php templates.
I have tested chatGPT and after a lot of trial and error gave me some good results in some simple display ACF with repeaters or relationships.
The best is to create a child theme for Twenty Twenty-Four and build your own templates or functions on it.
Firstly, please ensure you’re editing a child theme rather than the main Twenty Twenty Four theme. Otherwise your changes will just vanish whenever that parent theme receives an update.
Secondly, you’ll need to add the necessary PHP code (to display the data from the custom fields) into the template files where the fields are set to be displayed.
There’s a bunch of official documentation on both the [WordPress.org development portal](https://developer.wordpress.org/themes/basics/template-hierarchy/) & on the [ACF support section](https://www.advancedcustomfields.com/resources/displaying-custom-field-values-in-your-theme/).
On the WordPress documentation, pay attention to this notice:
“In these examples, the PHP file extension is used. In block themes, HTML files are used instead, but the template hierarchy is the same.”
I think there’s a difference between a full page builder like Elementor and using lighter weight plugins for specific tasks (like displaying the values ACF fields).
If you don’t end up going the custom code route, I’ve had a lot of success with the Meta Field Block plugin for displaying data from advanced custom fields: https://wordpress.org/plugins/display-a-meta-field-as-block/. It integrates easily with Gutenberg so even “non coders” should be able to make use of it.
If you use an FSE theme like twenty-twenty four you can edit the templates visually, you don’t need to code.
I guess you use the default block editor (Gutenberg). In this case, if you use Pods instead of ACF, you can directly query the fields using shortcodes: [https://docs.pods.io/displaying-pods/pods-shortcode/](https://docs.pods.io/displaying-pods/pods-shortcode/)
Just build your template with all your fields and assign the template to all the posts and pages you want and they’ll show.
If you don’t mind using a plugin, Generateblocks can display ACF fields using the “post meta” option and using the name of the field: [https://docs.generateblocks.com/article/dynamic-data-options-overview/#content-source](https://docs.generateblocks.com/article/dynamic-data-options-overview/#content-source)