Skip Navigation

[Resolved] Today – Post Date

This support ticket is created 6 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 -
- 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

Tagged: 

This topic contains 4 replies, has 2 voices.

Last updated by randallH-3 6 years, 9 months ago.

Assisted by: Noman.

Author
Posts
#617271
add_shortcode('past_year_date', 'get_past_year_date_fun');
function get_past_year_date_fun( $atts ) {
    // Attributes
    extract(shortcode_atts(
        array(
            'date' => '',
    'format' => 'M d, Y'
        ),
        $atts
    ));
     
    $past_date = strtotime("$date -1 year");
    $date = date($format, $past_date);
    return $date;
}
Current Date: [wpv-post-date] 
Past Year Date: [past_year_date date="[wpv-post-date]" format="M d, Y"]

Hi,

I found your code from another support ticket. Can't seem to make it work for <b>today - post date</b>. What workaround can I do?

#617298

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Randall,

Thank you for contacting Toolset support.

These shortcodes suppose to be work inside the view loop or content template.
https://toolset.com/documentation/user-guides/views-shortcodes/#vf-154574

Can you please let me know Where you need to use these shortcode?

Thank you

#617304

Inside the view loop.

#617309

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

For further debug, provide temporary access WP-Admin Login and FTP login info to your site. Your next answer will be private which means only you and I have access to it.

=== Please backup your database and website ===

✙ I would additionally need your permission to de-activate and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important.

Thank you

#619566

Thanks!