Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #207131

    Hello support,

    I’m importing products using wpallimport plugin.

    What I notice is that the default value for ‘Gallery Layout’ is ‘as background slider only’.

    Can this somehow be set by default to ‘Image list attached to the entry’ ?




    It was in the following file. the “std” value is the default option.


    “desc” => “Please choose how to display the images in the gallery above”,
    “id” => “gallery_layout”,
    “type” => “select”,
    “std” => “fixed attached_images bg_gallery”,
    “subtype” => array(
    ‘As background slsder only’ => “bg_gallery”,
    ‘Image list attached to the entry’ =>”fixed attached_images



    Glad you found the right file :)

    Best regards,



    Now I got the problem that the product is created witht the fixed attached_images bg_gallery option selected but the image does not show up until I do an explicit update of the product on the edit product page . After the update this piece of code is added.

    `<div class=”slideshow_container fixed attached_images bg_gallery autoslide_false”>’…………..

    So pls advise on how to automatically do this importing products with WP All Import.

    Or is there some way to update products in batch?





    I’m not sure if wp_update_posts will do the work. Let’s wait for Dude’s suggestion.




    This code

    function avia_set_gallery_layout()
    		$post_types = array('product');
    		$count = 0;
    		//iterate over each post type
    		foreach($post_types as $type)
    			//get all posts of a certain type
    			$the_query = new WP_Query( array('post_type' => $type, 'posts_per_page'=>-1) );
    			//check if any post were retrieved
    				//iterate over each post and check if the post has a gallery key
    				foreach($the_query->posts as $entry)
    					//since there might be hundreds of posts make sure php doesnt time out
    					$post_id =  $entry->ID;
    					//get meta array and check for the gallery_layout key
    					$meta = avia_post_meta($post_id);
    					if(empty($meta)) $meta = array();
    					$meta['gallery_layout'] = 'fixed attached_images bg_gallery';					
    					update_post_meta($post_id , '_avia_elements_theme_compatibility_mode', $meta);
    add_action( 'admin_init', 'avia_set_gallery_layout');

    will set the “gallery_layout” post meta field to “fixed attached_images bg_gallery” for all product entries. Insert it into the functions.php file, go to the admin page (it will probably load some time) and then remove it from functions.php – otherwise you’ll execute this script over and over again when you visit the admin page.


Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.