Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // To display taxonomy (category) on the Post Grid block. For that, you need to use the following filter in your fucntions.php file of the child theme.
- function single_post_title_before( $post_id, $attributes ) {
- if( 'my-post-grid-class' == $attributes['className'] ){
- $term_obj_list = get_the_terms( $post_id, 'category' );
- // Get the id of category
- $category_id = get_cat_ID( 'cat-4' );
- // Get the URL of this category
- $category_link = get_category_link( $category_id );
- $link = '<a href="' .$category_link .'">' .$term_obj_list[0]->name.'</a>';
- echo $link;
- }
- }
- add_action( 'uagb_single_post_before_title_grid', 'single_post_title_before', 10, 2 );
- // To apply different filters for a specific block you need to add a unique class to the block from the Advanced Tab of Post Grid Block. - https://imgur.com/qAye5Tn
- // Please refer to this screenshot - https://share.getcloudapp.com/v1uNPR0k
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement