[resolved] WP All Import - create multiple file path with [FOREACH] (2 posts)

  1. Schmalitz
    Posted 2 years ago #

    I need to solve following obstacle to create variable file-path:

    The FOREACH shortcode returns a specific XML-field like this:


    Resulting in

    Filename 1
    Filename 2
    Filename 3

    That's fine but I need to do this:

    fix/{CAT[1]}/Filename 1
    fix/{CAT[1]}/Filename 2
    fix/{CAT[1]}/Filename 3

    ...where {CAT[1]} is a variable output of the XML.

    Any ideas?

    Thank you very much for your help in advance!

  2. Schmalitz
    Posted 2 years ago #

    I also asked the official support (Soflyy) the same question and got the answer.

    Code for the functions.php:

    global $upc;
    function set_upc($local_upc){
    global $upc;
    $upc = $local_upc;
    function myfunc($files){
    global $upc;
    return $upc . '/' . $files;

    Code for the import template:

    <a href=>[myfunc({AudioFiles[1]/AudioFile[1]/Filename[1]})]

    Now its very easy to play around with the tempalte code to change the anchor text, structur etc.

    Thanks to Soflyy! Excellent support!

Topic Closed

This topic has been closed to new replies.

About this Topic