Hi @flog thanks for using the plugin!
The video guide was made with a recent version of the cms but without Gutenberg. When creating a template on the sidebar you must set the “Used by” field, save and reload the page, now under this field (Used by) all the shortcodes of the custom fields will be shown.
If you use Gutenberg you will also find a new element in “Layout elements” called “Custom field” which you can use.
To show the Taxonomies in the templates you have to create a shortcode that does this.
Here is an example of a shortcode that you can insert in the theme’s functions.php and then use it in the template (inserting it as a shortcode):
function print_tax_func() {
$current_post_id = get_the_ID();
$all_tax = get_taxonomies(array( 'name' => 'TAXONOMY_NAME' ));
$output = implode(', ', $all_tax);
return $output;
}
add_shortcode( 'print_tax', 'print_tax_func' );
Enter this code at the end of functions.php, replace TAXONOMY_NAME with the name of the taxonomy and use the shortcode [print_tax] when creating the template.
If you want to support the growth of the plugin and the release of new features in the next updates, leave your review 🙂
Thread Starter
flog
(@flog)
Hey Andrea
Thanks for your response.
I found the layout elements for the template. Now I have the problem that I get a “not valid JSON-response” when I save my template. I use the new WordPress Editor (Standard in 5.x), so I use Gutenberg.
I did the following:
– In the title I wrote the name of my custom template
– In the Block Parts I have this code:
<!– wp:heading {“level”:1} –>
<h1>[custom-field id=”title”]</h1>
<!– /wp:heading –>
<!– wp:paragraph –>
<p>[custom-field id=”image”]</p>
<!– /wp:paragraph –>
<!– wp:paragraph –>
<p>[custom-field id=”content”]</p>
<!– /wp:paragraph –>
Thanks for the taxonomy code. This is working charmly!
Thread Starter
flog
(@flog)
Ah, ok…I think I got it. I have to use only the HTML Content Part of Gutenberg. Then it works…
Thread Starter
flog
(@flog)
…sorry…it’s random…
If I put only paragraph with
<h1>[custom-field id=”title”]</h1>
then it works.
If I put more code in the same paragraph:
<h1>[custom-field id=”title”]</h1>
<p>
[custom-field id=”content”]
</p>
It doesn’t work…could you try it on your installation?
Hi @flog
I have run tests and everything seems to be working.
Use the form on my site (https://www.andreadegiovine.it/invia-suggerimento) to send me temporary credentials of your cms so I can check. You’d better take a backup first and create an account for me which you can then delete.