• Gaz

    (@gazzaisvgan)


    I am importing “Product” post types using the “Query Post” function.

    However, because I am using WordPress Express Checkout, there is no option to upload a “Featured Image” on each product post, and Post Grid doesn’t seem to be pulling in the Main or Thumbnail image from WordPress Express Checkout (unsure why).

    Is there any other way to bring an image into a Layout Grid Item? i.e a layout grid item being an individual box, which is calling in a post using “Query Post”.

    I am calling in the grid into a page using Basic Post Grid Shortcode.

    If anybody could shed any light on this, I would be extremely grateful.

    Thanks!

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

Viewing 1 replies (of 1 total)
  • Thanks for your post, we haven’t tried with WordPress Express Checkout plugin before, just test the plugin and notice that WEC is using a custom meta field for saving product thumbnails, this is definitely not a good idea as far I understand.

    You can’t display thumbnail from custom meta field using free version of post grid, neither using pro version.

    you will need to using action hook available or post grid media.

    
    
    add_action('post_grid_layout_element_media', 'post_grid_layout_element_media_30072021');
    
    function post_grid_layout_element_media_30072021($args){
    
        $element  = isset($args['element']) ? $args['element'] : array();
        $elementIndex  = isset($args['index']) ? $args['index'] : '';
        $post_id = isset($args['post_id']) ? $args['post_id'] : '';
    
        if(empty($post_id)) return;
    
        $custom_class = isset($element['custom_class']) ? $element['custom_class'] : '';
    
        $wpec_product_thumbnail = get_post_meta($post_id,'wpec_product_thumbnail', true);
    
            ?>
        <div class="element element_<?php echo esc_attr($elementIndex); ?> <?php echo esc_attr($custom_class); ?> element-media ">
            <img />">
        </div>
            <?php
    }
    
    • This reply was modified 3 years, 3 months ago by hasanrang05.
Viewing 1 replies (of 1 total)
  • The topic ‘Image Display in Layout Grid Item’ is closed to new replies.