Site logo

[Support request] Custom Taxonomy not displaying in Dynamic Data

Home Forums Support [Support request] Custom Taxonomy not displaying in Dynamic Data

Home Forums Support Custom Taxonomy not displaying in Dynamic Data

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #2452825
    Robert

    Hi,
    I am using:
    Generatepress
    Generateblocks
    ACF
    Custom Post Type UI

    I have created a custom taxonomy called Sector using the Custom Post Type UI.
    I then created a custom taxonomy field in ACF. I was able to select the sector taxonomy from the list.
    I then go to my page editor and have the ability to create a ‘New Sector’ and have added a ‘Music’

    When I then use the dynamic data option within generateblocks I use data source as current post, Content source as meta data and the post meta field as sector. Nothing is displayed.

    I have several other fields (not taxonomy) displaying correctly by exactly the same method on the same page.
    There is data entered in the sector field.

    Can you help me understand what I am doing wrong and what to check?

    I have a published page and near the top it says Sector and next to it should be the field data.
    https://cryptosavvylife.com/project/audius-template-version/

    Lots of other data on the same page is coming from the Custom fields of ACF eg blockchain > Ethereum, Coin / Token > AUDIO

    The main reason for creating the custom fields using ACF is for displaying various filter pages based on the field eg a page filtered by blockchain> Ethereum.

    Thanks in advance!
    Rob

    #2453539
    Ying
    Staff
    Customer Support

    Hi Rob,

    Can you take screenshots of the settings of the sector in ACF and the settings in GB (how you pull the data)?

    You can upload your screenshots here and share the link with us:
    https://postimages.org/

    Let me know!

    #2453716
    Robert

    Hi,
    I have been trying to play with this and have still had no luck but have changed the name of the field from sector to project_sector in case it was a conflict with the other title.

    I have attached lots of screen shots!
    https://postimg.cc/gallery/dKxKqXq

    – The CPT UI Taxonomy – taken of the settings where I created the custom taxonomy

    – ACF project sector – of the settings within the ACF plugin

    – Page Layout 1 of the GB; this shows all the other fields I am using that all work

    – Page layout showing Directory Fields; shows all the other fields including the project_sector that is populated with entertainment, music and gaming

    – Website view; having updated the published page this is what I see, shows the other fields correctly with dynamic data but not the taxonomy / project_sector

    Do let me know if logging in is helpful.

    Thanks for your help,

    #2453884
    Fernando
    Customer Support

    Hi Robert,

    Custom Taxonomies still isn’t supported as Dynamic data for GB.

    Try adding cu-tax-headline to the classist of your Dynamic GB Headline Block.

    Adding Custom Classes: https://wordpress.com/support/wordpress-editor/adding-additional-css-classes-to-blocks/

    Then, add this snippet:

    add_filter('generateblocks_dynamic_content_output', function($content, $attributes, $block){
    	if ( ! empty( $attributes['className'] ) && strpos( $attributes['className'], 'cu-tax-headline' ) !== false ) {
    		$terms = get_field('custom-tax');
    		$output = '<ul>'; 
    		foreach( $terms as $term ){
    			$output = $output . '<li>' . '<a href="' . esc_url( get_term_link( $term ) ) . '">' . esc_html( $term->name ) . '</a></li>';
    		}
    		$output = $output . '</ul';
    		return $output;
    	}
    	return $content;
    }, 10, 3);

    Replace custom-tax with your field name project_sector

    Adding PHP: https://docs.generatepress.com/article/adding-php/#code-snippets

    Let us know how it goes.

    #2454051
    Robert

    Thats great!!
    It now comes as a bullet list (see photo link) and the fact that I can now link to that category is great. (Im hoping that I will now be able to search within those taxonomies?)

    https://postimg.cc/N2ryDhws

    If I add another custom taxonomy do I simply do the same again, with a different class name for the GB block and the appropriate field rather than project_sector, for the PHP?

    Thanks,
    Rob

    #2454086
    Fernando
    Customer Support

    You can apply custom CSS to alter the appearance of the categories if you want.

    Can you clarify what you mean when you say “I’m hoping that I will now be able to search within those taxonomies?”

    Yes, same code, just a different class and taxonomy field name.

    We’re slowly adding support for more custom fields, and hopefully, in the near future, we can support this as well.

    #2454116
    Robert

    Wow you guys are quick!
    Absolutely the best support!!

    So I said search but think I mean filter?!
    I would like to set up something that lets users filter for different sector and sub-sector.
    I was planning to do it thru an element but not sure which or how yet, I need to follow the document videos!

    Thanks

    #2454137
    Fernando
    Customer Support

    I’m not sure if I’m understanding correctly, but if you’re looking for a filter, you’ll need a third-party plugin for that. You can view this thread, some customers provided their insights, and useful plugins: https://community.generateblocks.com/t/taxonomy-filters-for-query-loop-block/1086

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.