• Resolved axelmktg

    (@axelmktg)


    I have several feeds, where i would like to import posts with the following options:

    1) element set to a date field with the following format = 04/21/2016
    2) rule set to “equals or greater than” or “equals or less than”
    3) value set to “today”

    I would like to import posts with a field date either prior or after today.
    I have tried several combinations, however, neither produce appropriate results (all get There are no elements to import based on your XPath). This is possible with WP All Export, if i set the element to (Date Y:m:d H:i:s).

    Please assist with finding a solution.

    Thank you,

    Axel.

    https://www.ads-software.com/plugins/wp-all-import/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter axelmktg

    (@axelmktg)

    Here is what my xpath is /deal[@end_on >= today]

    Plugin Author WP All Import

    (@wpallimport)

    Hi axelmktg,

    Did using /deal[@end_on >= today] solve the issue for you?

    Thread Starter axelmktg

    (@axelmktg)

    This was just an example, of it is currently set to.
    It still does not work.

    Axel.

    Thread Starter axelmktg

    (@axelmktg)

    P.S the date format i am comparing to is mm/dd/year

    Plugin Author WP All Import

    (@wpallimport)

    Ok, thanks for the clarification. I was able to reproduce this on our end. We’ll get back to your as soon as possible.

    Plugin Author WP All Import

    (@wpallimport)

    This is happening because XPath 1.0 does not support these kinds of date filters. In WP All Export we don’t need to rely on XPath, we use SQL to build the filters.

    You can, however, use a bit of custom code to filter out the dates. Here’s an example to get you started:

    add_filter( 'wp_all_import_is_post_to_create', 'axelmktg_date_filters', 10, 2 );
    
    function axelmktg_date_filters( $current_xml_node, $import_id ) {
        return ( strtotime(trim($current_xml_node['date']) >= time() ) ? true : false;
    }

    This code can be added to your functions.php file, or WP All Import’s Function Editor.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘import with filter option set to date’ is closed to new replies.