- This topic has 8 replies, 2 voices, and was last updated 3 years, 3 months ago by
Fernando.
-
AuthorPosts
-
December 21, 2022 at 5:36 pm #2469984
John
Hi there,
I’m creating a Content Template Element for a specific post type (“Event”), and when I’m using the Dynamic Options to display some custom taxonomy terms. However, they’re just not showing up on the front-end — there is nothing.
However I’ve used the same feature in the same way for a different post type (“Provider”) and it’s working as intended. The taxonomies are accessible to the REST API (I’ve displayed the same ones in a different content template). What might be the cause of the issue?
See screenshots:
– Edit page: https://i.imgur.com/zPONAjx.png
– Front-end: https://i.imgur.com/0PDeWez.pngThank you for your help
December 21, 2022 at 5:45 pm #2469987Fernando Customer Support
Hi John,
Can you double-check if the custom taxonomy slug you set in the Dynamic settings is correct?
Can you also try creating a new test custom taxonomy for “Events” and retrieve this in the same way?
Let us know how it goes.
December 21, 2022 at 6:28 pm #2470011John
Fernando,
Yes the slug is correct – I don’t type it, I select it from the list.
I did as you suggested, created a new custom taxonomy and assigned it to Events. I added it to the template and it did the same thing, it doesn’t show up :/
December 21, 2022 at 8:41 pm #2470057Fernando Customer Support
I see. That’s odd.
Can you double-check as well if there’s any difference in terms of the settings of CPTs “Events” and “Provider”?
If there’s none, can you try #1 here?: https://docs.generatepress.com/article/debugging-tips/
It would be best to take a backup of your site before doing this. Or, if you can start a staging site, that would be better.
We’ve had one instance of a similar issue where the cause was a setting from a third-party plugin.
Let us know how it goes.
December 21, 2022 at 11:20 pm #2470125John
The CPTs have slightly different settings but nothing that I can see causing an issue. Plus, I’ll add that on other pages I’ve been able to retrieve the Event custom field values using the GB Pro Query Loop. So I really get the impression that the issue isn’t coming from the CPT config, but from the Dynamic Options feature in some way. I hope I’m wrong though.
Here is Event:
<?php add_action( 'init', 'your_prefix_register_post_type' ); function your_prefix_register_post_type() { $labels = [ 'name' => esc_html__( 'Events', 'your-textdomain' ), 'singular_name' => esc_html__( 'Event', 'your-textdomain' ), 'add_new' => esc_html__( 'Add New', 'your-textdomain' ), 'add_new_item' => esc_html__( 'Add New Event', 'your-textdomain' ), 'edit_item' => esc_html__( 'Edit Event', 'your-textdomain' ), 'new_item' => esc_html__( 'New Event', 'your-textdomain' ), 'view_item' => esc_html__( 'View Event', 'your-textdomain' ), 'view_items' => esc_html__( 'View Events', 'your-textdomain' ), 'search_items' => esc_html__( 'Search Events', 'your-textdomain' ), 'not_found' => esc_html__( 'No events found.', 'your-textdomain' ), 'not_found_in_trash' => esc_html__( 'No events found in Trash.', 'your-textdomain' ), 'parent_item_colon' => esc_html__( 'Parent Event:', 'your-textdomain' ), 'all_items' => esc_html__( 'All Events', 'your-textdomain' ), 'archives' => esc_html__( 'Event Archives', 'your-textdomain' ), 'attributes' => esc_html__( 'Event Attributes', 'your-textdomain' ), 'insert_into_item' => esc_html__( 'Insert into event', 'your-textdomain' ), 'uploaded_to_this_item' => esc_html__( 'Uploaded to this event', 'your-textdomain' ), 'featured_image' => esc_html__( 'Featured image', 'your-textdomain' ), 'set_featured_image' => esc_html__( 'Set featured image', 'your-textdomain' ), 'remove_featured_image' => esc_html__( 'Remove featured image', 'your-textdomain' ), 'use_featured_image' => esc_html__( 'Use as featured image', 'your-textdomain' ), 'menu_name' => esc_html__( 'Events', 'your-textdomain' ), 'filter_items_list' => esc_html__( 'Filter events list', 'your-textdomain' ), 'filter_by_date' => esc_html__( '', 'your-textdomain' ), 'items_list_navigation' => esc_html__( 'Events list navigation', 'your-textdomain' ), 'items_list' => esc_html__( 'Events list', 'your-textdomain' ), 'item_published' => esc_html__( 'Event published.', 'your-textdomain' ), 'item_published_privately' => esc_html__( 'Event published privately.', 'your-textdomain' ), 'item_reverted_to_draft' => esc_html__( 'Event reverted to draft.', 'your-textdomain' ), 'item_scheduled' => esc_html__( 'Event scheduled.', 'your-textdomain' ), 'item_updated' => esc_html__( 'Event updated.', 'your-textdomain' ), 'text_domain' => esc_html__( 'your-textdomain', 'your-textdomain' ), ]; $args = [ 'label' => esc_html__( 'Events', 'your-textdomain' ), 'labels' => $labels, 'description' => '', 'public' => true, 'hierarchical' => false, 'exclude_from_search' => false, 'publicly_queryable' => true, 'show_ui' => true, 'show_in_nav_menus' => true, 'show_in_admin_bar' => true, 'show_in_rest' => true, 'query_var' => true, 'can_export' => true, 'delete_with_user' => false, 'has_archive' => false, 'rest_base' => '', 'show_in_menu' => true, 'menu_position' => 21, 'menu_icon' => 'dashicons-calendar-alt', 'capability_type' => 'post', 'supports' => ['title', 'thumbnail', 'custom-fields', 'author'], 'taxonomies' => ['language', 'country', 'topic', 'event-type', 'licensee-category'], 'rewrite' => [ 'with_front' => true, ], ]; register_post_type( 'event', $args ); }And here is Provider:
<?php add_action( 'init', 'your_prefix_register_post_type' ); function your_prefix_register_post_type() { $labels = [ 'name' => esc_html__( 'Providers', 'your-textdomain' ), 'singular_name' => esc_html__( 'Provider', 'your-textdomain' ), 'add_new' => esc_html__( 'Add New', 'your-textdomain' ), 'add_new_item' => esc_html__( 'Add New Provider', 'your-textdomain' ), 'edit_item' => esc_html__( 'Edit Provider', 'your-textdomain' ), 'new_item' => esc_html__( 'New Provider', 'your-textdomain' ), 'view_item' => esc_html__( 'View Provider', 'your-textdomain' ), 'view_items' => esc_html__( 'View Providers', 'your-textdomain' ), 'search_items' => esc_html__( 'Search Providers', 'your-textdomain' ), 'not_found' => esc_html__( 'No providers found.', 'your-textdomain' ), 'not_found_in_trash' => esc_html__( 'No providers found in Trash.', 'your-textdomain' ), 'parent_item_colon' => esc_html__( 'Parent Provider:', 'your-textdomain' ), 'all_items' => esc_html__( 'All Providers', 'your-textdomain' ), 'archives' => esc_html__( 'Provider Archives', 'your-textdomain' ), 'attributes' => esc_html__( 'Provider Attributes', 'your-textdomain' ), 'insert_into_item' => esc_html__( 'Insert into provider', 'your-textdomain' ), 'uploaded_to_this_item' => esc_html__( 'Uploaded to this provider', 'your-textdomain' ), 'featured_image' => esc_html__( 'Featured image', 'your-textdomain' ), 'set_featured_image' => esc_html__( 'Set featured image', 'your-textdomain' ), 'remove_featured_image' => esc_html__( 'Remove featured image', 'your-textdomain' ), 'use_featured_image' => esc_html__( 'Use as featured image', 'your-textdomain' ), 'menu_name' => esc_html__( 'Providers', 'your-textdomain' ), 'filter_items_list' => esc_html__( 'Filter providers list', 'your-textdomain' ), 'filter_by_date' => esc_html__( '', 'your-textdomain' ), 'items_list_navigation' => esc_html__( 'Providers list navigation', 'your-textdomain' ), 'items_list' => esc_html__( 'Providers list', 'your-textdomain' ), 'item_published' => esc_html__( 'Provider published.', 'your-textdomain' ), 'item_published_privately' => esc_html__( 'Provider published privately.', 'your-textdomain' ), 'item_reverted_to_draft' => esc_html__( 'Provider reverted to draft.', 'your-textdomain' ), 'item_scheduled' => esc_html__( 'Provider scheduled.', 'your-textdomain' ), 'item_updated' => esc_html__( 'Provider updated.', 'your-textdomain' ), 'text_domain' => esc_html__( 'your-textdomain', 'your-textdomain' ), ]; $args = [ 'label' => esc_html__( 'Providers', 'your-textdomain' ), 'labels' => $labels, 'description' => 'Providers of products or services as part of the Holacracy licensing program', 'public' => true, 'hierarchical' => false, 'exclude_from_search' => false, 'publicly_queryable' => true, 'show_ui' => true, 'show_in_nav_menus' => true, 'show_in_admin_bar' => true, 'show_in_rest' => true, 'query_var' => true, 'can_export' => true, 'delete_with_user' => false, 'has_archive' => false, 'rest_base' => '', 'show_in_menu' => true, 'menu_position' => 20, 'menu_icon' => 'dashicons-businessman', 'capability_type' => 'custom', 'supports' => ['title', 'revisions', 'custom-fields', 'author'], 'taxonomies' => ['licensee-type', 'language', 'licensee-category', 'country'], 'rewrite' => [ 'slug' => 'provider', 'with_front' => true, ], ]; register_post_type( 'licensee', $args ); }December 21, 2022 at 11:36 pm #2470134John
I seem to have found the issue! It’s apparently a problem between Dynamic Options from GP and Dynamic Data from GB. On the two buttons that didn’t appear, I had some options selected in the Dynamic Data options, but I didn’t see them because they were collapsed after I deactivated Dynamic Data. But somehow it conflicted with the Dynamic Options.
When I reactivated Dynamic Data to look, I unselected the options that were selected, then deactivated Dynamic Data again, and now when I reload the front-facing page, the custom taxonomies appear.
December 21, 2022 at 11:44 pm #2470139Fernando Customer Support
I see. Glad you found the issue! Yes, you should only use either of those setting – not both at the same time.
December 21, 2022 at 11:48 pm #2470141John
To clarify, I was not using both settings – the Dynamic Data settings were toggled OFF, even though some of its options had been selected before being toggled off.
I emphasize the point because I would qualify that as a bug (or if not a bug, a UI design faux pas). When the user toggles Dynamic Data OFF, the expected behavior is that Dynamic Data features are deactivated and won’t have an impact anywhere.
But thank you, I’m glad it’s solved. I hope this solution can be useful to others
December 21, 2022 at 11:52 pm #2470144Fernando Customer Support
I see. Thank you for letting us know. We’ll test this out.
-
AuthorPosts
- You must be logged in to reply to this topic.