• Resolved Iacopo

    (@iacopoincerpi)


    Hi, I have a problem on this page. It’s a blog category, and there’s a template set. From Pods, I’ve extended the category and added an image field to use as a background for the section. The template was set correctly for over 2 years, but now the images have disappeared

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Paul Clark

    (@pdclark)

    It’s not clear where the image is supposed to appear or what type of template is in use, but generally, whether in Elementor or any WordPress taxonomy archive, an image can be added to CSS specific to a taxonomy term like below, where the taxonomy is category, the field name is background_image, and the CSS selector is h1.wp-block-query-title :

    <?php
    /**
    * Add a background image to CSS on a category archive from field background_image.
    */
    add_action(
    'wp_head',
    function() {
    // If this is not a category archive, do nothing.
    if ( ! is_category() ) { return; }

    $attachment_id = get_term_meta(
    get_queried_object()->term_id,
    'background_image',
    true
    );
    // If there is no image set in the category term field, do nothing.
    if ( empty( $attachment_id ) ) { return; }
    // $attachment will contain an array of URL, width, height.
    // The image size is 'large'.
    $attachment = wp_get_attachment_image_src( $attachment_id, 'large' );

    // Output a stylesheet with the URL and a minimum height based on the image dimensions.
    // In printf/sprintf syntax, if a literal % sign is desired, it would be %%.
    printf(
    <<<'TEMPLATE'
    <style>
    h1.wp-block-query-title {
    background-image: url( %s );
    background-repeat: no-repeat;
    background-size: cover;
    min-height: %dpx;
    }
    </style>
    TEMPLATE,
    esc_url( $attachment[0] ),
    intval( $attachment[1] )
    );
    },
    PHP_INT_MAX
    );
    Thread Starter Iacopo

    (@iacopoincerpi)

    In the first section, on the background. Screenshot-2024-06-12-105000.png (639×344) (ibb.co)

    For now i’ve fixed with custom code. But this configuration always worked well

    Plugin Support Paul Clark

    (@pdclark)

    Thanks for the screenshot. Glad you found a solution.

    We don’t have the ability to edit the integration written by the Elementor team… many of its features are still inconsistent or incomplete.

    It would take access to the specific install to identify the cause.

    There is also an Elementor module written by an author of Pods available as the Page Builder add-on from skc.dev

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