• Resolved xdelios

    (@xdelios)


    Hello,

    I am trying to import image url from a single CSV column.

    There is a column named images and has the following values inside parenthesis

    Small (link1)
    Medium (link2)
    Large (link3)

    now lets say I want to import only link3, how can I do that with XPath ?
    Because if I simply drag and drop images values it gets the whole thing as text and obviously nothing is shown.

    Thanks in advance

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author WP All Import

    (@wpallimport)

    Hi @xdelios

    now lets say I want to import only link3, how can I do that with XPath ?

    Based on your description, you’d have to use a custom PHP function to get the last link: http://www.wpallimport.com/documentation/developers/execute-php/. For example, to return “link3” from the data you showed us, something like this should work:

    function my_get_last_link( $images ) {
    	preg_match_all( '/(?<=\()(.*?)(?=\))/', $images, $matches );
    	if ( ! empty( $matches ) ) {
    		return array_pop( $matches[0] );
    	}
    }
    Plugin Author WP All Import

    (@wpallimport)

    @xdelios I’m marking this as resolved since we haven’t heard back. Let us know if you have any more questions regarding this issue. Anyone else please open a new thread.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Multiple values within image column in CSV’ is closed to new replies.