xml - WP All Import Plugin - Image Foreach loop -


i'm wordpress beginner please bear me. i'm using wp import import data, , there few images stored child elements of parent element.

following screen shot of xml exported phpmyadmin. structure different see wp import youtube tutorial. i'm not sure whether correct data can imported successfully.

enter image description here enter image description here

from screen shot (please take note on red boxes), have same information different id , images. question can use foreach loop case? , how write foreach loop based on case?

this code took wp import website. cannot follow same xml has different structure.

example xml:  <images> <image src=”image1.jpg” alt=”i first image”>featured image</image> <image src=”image2.jpg” alt=”this image2″>second image</image> <image src=”image3.jpg” alt=”this image3″>third image</image> <image src=”image4.jpg” alt=”this image4″>fourth image</image> </images>  use following foreach loop:  [foreach({images/image})] http://www.example.com/my-folder/{@src}, [endforeach] 

i solved using sql group concat combine images same id.

select *, group_concat(distinct concat('<img><url>',filename,'</url></img>') separator '\n') album_pictures  group album_id 

so result:

enter image description here

the used foreach loop read images.

[foreach({column[22]/img})] http://www.example.com/my-folder/{url[1]} [endforeach] 

Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -