• Resolved covacs77

    (@covacs77)


    Hello!

    I created the code so as not to fill empty lines when importing

    <?php
    $mass = {column_5[1]};
    if ( !empty ($mass)) {
    echo "<p>Author: ".$mass[0]."</p>";
    }
    ?>

    It is not right to insert this into the visual editor window. How to correctly create a function to use when importing to not insert empty and zero values?

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

    (@wpallimport)

    Hi @covacs77

    You can either use an XPath IF statement for this, example:

    [IF({column_5[1][.!="0" and .!=""]})]<p>Author: {column_5[1]}</p>[ELSE][ENDIF]

    Or, you can pass the element to a PHP function in the import template like so: [my_check_author({column_5[1]})]. Then, add this code to the Function Editor:

    function my_check_author( $author = '' ) {
        return ( empty( $author ) ) ? null : "<p>Author: " . $author . "</p>";
    }

    Read more here: http://www.wpallimport.com/documentation/developers/execute-php/.

Viewing 1 replies (of 1 total)

The topic ‘Function does not fill zero values (All Import Pro)’ is closed to new replies.