• Resolved Francisco Mendieta

    (@franciscomendieta)


    I need to make an import for JSON url files.
    I will need scheduling and some data transformation.
    I tested the shortcode method to call a custom function to change a source date field. But the shortocode is not running, and the function is not running.
    The shortcode: [wpie_function custom_function=”fm_getdate” ]
    The documentation about using the shortcode: https://plugins.vjinfotech.com/wordpress-import-export/documentation/add-shortcode/
    The function in functions.php:
    function fm_getdate ( ) {
    $fecha = new DateTime();
    return $fecha->format(“Y-m-d H:i”);
    }

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author vjinfotech

    (@vjinfotech)

    Hi,

    Thanks for getting in touch.

    [wpie_function custom_function="fm_getdate" date="{customdate[1]}" ]
    
    function fm_getdate( $attr = [], $content = "" ) {
            $date = isset( $attr[ "date" ] ) ? $attr[ "date" ] : "";
            if ( empty( $date ) || strtotime( $date ) === false ) {
                    return "";
            }
    
            return date( 'Y-m-d H:i', strtotime( $date ) );
    
    }

    {customdate[1]} is your date field so replace it with your field from list

    let me know if you have any questions

    Thanks and have a nice day

    • This reply was modified 4 years, 1 month ago by vjinfotech.
Viewing 1 replies (of 1 total)
  • The topic ‘Import manipulate with shortcode / function’ is closed to new replies.