[Resolved] Help with Template Tags for Custom Post Type

Home Forums Support [Resolved] Help with Template Tags for Custom Post Type

Home Forums Support Help with Template Tags for Custom Post Type

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1538380
    Huseyin

    Hi Team,

    Need help with Template Tags for Custom Post Type, so I have created CPTs with Pods Plugin. Need help on generating data from Custom Taxonomy field. {{post_terms.taxonomy}} Tried different variations but couldn’t succeed.

    Let’s say the Custom Taxonomy is “grade” then what is Template Tag?

    Thanks

    #1538576
    David
    Staff
    Customer Support

    Hi there,

    you replace taxonomy with the taxonomy term, if that is grade then it would be:

    {{post_terms.grade}}

    #1538633
    Huseyin

    Hi David,

    How strange I tried many different variations with the tag? Once again thanks for the reply/help.

    However some of my taxonomies have an archive page, but I don’t want this {{post_terms.grade}} tag to generate link to the archive page. How could i achieve this?

    Thanks

    #1538671
    David
    Staff
    Customer Support

    Do you need to remove the link? Or just disable the link?

    Disabling the link would be simple – you would wrap your code like so:

    <span class="no-link">{{post_terms.grade}}</span>

    Then add this CSS:

    .no-link a {
        pointer-events: none;
    }

    Removing the link entirely would require creating a shortcode to get the post terms….

    #1539711
    Huseyin

    Sorry for not accurate with my request.

    I would like to remove the link, please.

    #1540350
    Tom
    Lead Developer
    Lead Developer

    To remove it completely you’d need to build your own shortcode:

    add_shortcode( 'my_terms', function( $atts ) {
        $options = shortcode_atts( array(
            'term' => 'category',
        ), $atts );
    
        $terms = get_the_term_list( get_the_ID(), $options['term'], '', ', ', '' );
    
        if ( ! is_wp_error( $terms ) ) {
            return strip_tags( $terms );
        }
    } );

    Then you should be able to do this:

    [my_terms term="grade"]

    #1543955
    Huseyin

    THANKS, TOM,

    Wondering when will be able to use Template Tags with GenerateBlocks? (i have few projects, want to plan out my tasks that’s im asking)

    #1544884
    Tom
    Lead Developer
    Lead Developer

    We’re working on it – no specific date yet 🙂

    #1545477
    Huseyin

    Thanks

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