Within a loop over products, where a taxonomy new_taxonomy has been added with Pods using the Connections when extending products, and an image field named featured_category_image has been added to that taxonomy:
[pods use_current="1" name="product"]{@new_taxonomy.featured_category_image}[/pods]
…should display an image tag
[pods use_current="1" name="product"]{@new_taxonomy.featured_category_image._src.medium}[/pods]
…should display the URL for a medium thumbnail.
https://docs.pods.io/displaying-pods/magic-tags/using-magic-tags/
Hello Paul,
Can not get it to work, thanks for fast reply.
I have a custom pods category (name merken), connected to products woocommerce. Thats working good, discription is loading inside elementor template product archief. But there is no featured image for this “merken” category. I did try to add an image upload to new pods category merken, named it featured_category_image, did try shortcode, not working, did try category image, not working, did try pods > image feeld > featured_category_image inside dynamic content elementor, what i can sellect, but it still not visible.
For now I did make for each pods category an own elementor product archief page and manual selected image like a normal image. But would be great if dynamicly elementor wil load the image “fatured_category_image“
I think I do not understand you
I’m getting some content, simple with: [pods field=”featured_category_image”]I do see now the image url. Can not get that loaded inside container background image. A few years ago I remember there was an plugin to extend the dynamic load image with shortcode. Can not find it. But should the dynamic pods loader, where you see fatured_category_image not just load? Its somehow not.
The Pods team does not write or maintain Elementor’s interface for displaying fields for Pods. It is not thorough in its representation of available fields.
There is an Elementor plugin built by the Pods team which supports many page builders in a way consistent with the Pods Block Editor blocks linked in the Pods readme.
If you are outputting content in an Elementor module which supports both raw HTML and shortcodes, perhaps the code modules, you should be able to add CSS which selects the layout item you’d like to have the image as the background:
<style>
body {
background-image: url( "[pods field="featured_category_image"]" );
background-repeat: none;
background-size: cover;
}
</style>
If that does not work within the Elementor editor, the PHP equivalent would be:
<?php
/**
* Plugin Name: Category Image Style
*/
add_action(
'wp_head',
function() {
$taxonomy_name = 'category';
if (
is_tax( $taxonomy_name )
&& is_a( get_queried_object(), 'WP_Term' )
) {
printf(
<<<'CSS'
<style>
body {
background-image: url( "%s" );
background-repeat: none;
background-size: cover;
}
</style>
CSS,
pods(
$taxonomy_name,
get_queried_object()->term_id
)->field('featured_category_image._src')
);
}
}
);
…where the taxonomy name is category, the page being viewed is a taxonomy archive (not a post type page listing posts from a taxonomy), the CSS selector for the image to be used as a background is body and the field name is featured_category_image
Thanks again Paul for the fast reply.
Wil try that. I did try the css, but maybe I did something wrong. At custum css theme I think the shortcode did not load.