Try this, you can’t just throw a conditional block inside an echo
statement. If you really need to it has to be a shorthand if-else, but for visual purposes I have put the statement outside the loop:
$taxonomy = 'product-categories';
$tax_terms = get_terms( $taxonomy );
foreach($tax_terms as $tax_term) {
$terms = apply_filters( 'product-categories-images-get-terms', '' ); ?>
$imgUrl = ( function_exists( 'z_taxonomy_image_url' ) ) ? z_taxonomy_image_url() : '';
echo '<li><img src="' . $imgUrl . '" /><a href="' . esc_attr( get_term_link( $tax_term, $taxonomy ) ) . '" title="' . sprintf( __( "View all posts in %s" ), $tax_term->name ) . '" ' . '>' . $tax_term->name . '</a></li>';
}
Related Posts:
- How to prevent new terms being added to a custom taxonomy?
- WP REST API no longer supports filter param, so how do I get posts in a custom taxonomy?
- Include and Exclude Taxonomies From Archives & Feeds Using ‘pre_get_posts’
- Custom Taxonomy not working with posts_per_page in new WP_query (pagination problem)
- Get value in custom field with taxonomy [closed]
- Get second level terms of custom taxonomy
- Taxonomy menu with post count and multiple parents
- Sort Custom Post Type Archive by Taxonomy Term [duplicate]
- Modify Term Update Redirection
- How to get first post in a category of a custom taxonomy
- How to get the singular name of a custom taxonomy?
- Archive template for taxonomy terms
- pre_get_posts OR relation between taxonomy and author
- Custom Fields and performance
- Non-hierarchical custom taxonomy using checkboxes on edit-screen -> saving issue
- Dynamic page slug for Custom Taxonomies?
- show term description instead of list terms of custom taxonomy
- get_the_term_list without specific category
- Add Category Name to REST API
- Display the Terms from a Custom Taxonomy Assigned to a Post(inside the loop) in Hierarchial Order
- Edit post meta with checkboxes on front end
- drop-down list taxonomy problem
- Redirect to Post List by Taxonomy on User Selection of Taxonomy Dropdown?
- How do I get WordPress URL rewrites into Sitemap?
- How to display custom taxonomy in multiple columns?
- Custom taxonomy sort by term meta in admin columns
- Storing data into custom taxonomies VS post custom fields (post meta)
- Removing the “Popular Terms” area from the Taxonomy Edit Screen in the Admin Area
- Programatically added attribute, set to ‘show on product page’ automatically. Woocommerce [closed]
- WordPress Custom Taxonomy – Volume / Issue – Unique Slug Issue
- How to show the entries in a custom taxonomy by author?
- Metabox to list/store a certain type of post tag
- Get Current Custom Taxonomy ID by Post ID
- Custom fields to taxonomy
- Correct way to insert taxonomies on page insert
- Get_terms stopped working after WP 4.2
- Styling Taxonomy Terms Individually
- Get terms cross-taxonomy query
- Custom Taxonomy Template Error: Catchable fatal error: Object of class WP_Error could not be converted to string
- remove custom taxonomy base / slug [duplicate]
- triple drop down for populating custom taxonomies
- Custom Taxonomy in default RSS feed
- How to make custom post taxonomy looks like regular categories?
- Create Geographical regions -> countries structure and relationship with taxonomies
- Unexpected results from get_taxonomies() and {$taxonomy}_edit_form and related hook
- Custom Taxonomy Term Archive Page Template that Filters 2 or more Taxonomies
- Custom taxonomy link opens under Posts
- Changing URLs for taxonomies and CPT
- Front-End Custom Taxonomy Tag Select
- Display all posts that use a custom taxonomy
- Override Taxonomy Template
- Set tax_query conditionally with new WP_Query
- how to store values in database at hierarchical view
- Strip tags from a the terms() function
- Why can’t I use an array of term slugs in WP_Query?
- Using wp_dropdown_categories in widget options
- Trying to add taxonomy to get_categories() but it’s not working. How to fix this?
- Custom taxonomy archive page requires ?post_type= in url
- Custom taxonomy terms not showing as list Gutenberg Editor WordPress
- Twin value tags as an esoteric taxonomy
- Adding a custom taxonomy to “nav_menu_item”
- Clean Custom URL for Serach + Custom Taxonomy
- Advanced search redirecting to another page then filter further
- pagination not working on custom-taxonomy template
- Limit Display Number Of Taxonomy Term
- Custom arguments in WP_Query
- Sort and paginate custom post taxonomies alphabetically
- Current taxonomy name (not term!) given a post ID
- Search box with field hidden till drop down selection is made
- Can You Build Page Templates Without Extra Files
- 404 Error on Custom Post Type / Custom Taxonomy
- Unsetting post_tag taxonomy breaks term description for other taxonomies
- Taxonomies on Pages with Custom Formatting
- Terms added to custom taxonomy for custom post type only appear in Rest when added in code
- Is there a way to nest taxonomies or custom fields deeper than one level below the post type?
- Prioritise Pages over Taxonomy Term Root Archive, but not Taxonomy Term Child Archives
- Showing custom taxonomy in woocommerce signle product page
- Gutenberg Block Editor – Create block with dynamic content
- Get custom taxonomy terms that contain posts that have another taxonomy term
- Custom taxonomy not showing in grid view for ‘attachment’ post type
- How To Create Dynamic Permalink To Custom Taxonomy List of Current Posts?
- How to create archive pages for metadata query generated posts (so without taxonomy)?
- How to create a completely functioning separate archive for posts from only 1 or 2 specific categories
- How to get list of custom taxonomies based on custom post type
- how to filter the data’s comparison operators (>= &
- Sort Taxonomy List by Custom Values
- How to filter a taxonomy meta field to the ‘single_term_title’ filter hook
- Using wp_tag_cloud with only current post tag with special class
- Custom taxonomy rewrite in permalinks for posts gives 404 on pages
- Query pages by child term
- Custom taxonomy applied to links [duplicate]
- Next/Previous links in custom taxonomy, where item may belong to multiple terms
- rewriting for custom taxonomy rewrite
- Custom Taxonomy registered with multiple custom posts
- Insert term description programmatically into hierarchical custom taxonomy
- Custom Taxonomy + JQuery Tabs
- Get all taxonomy posts by id
- Custom Taxonomy Template Variables Available?
- i need to show featured post on custom taxonomy page
- Gravity Forms with Advanced Post Creation Add-On not updating ACF fields on custom taxonomy