0

I'm using a plugin (Time.ly) which allows for shortcodes. The shortcode values set the display. I'd like to set one of the value's via current date and return the first of the month. Can I modify this with javascript or had the shortcode been digested by PHP and I need to use functions.php?

Given shortcode :

[ai1ec view="agenda" events_limit="5" cat_name="metalsmithing-lvl-1" display_filters="false" exact_date="09-01-2016"]

I'd want to always have exact_date="FIRST OF CURRENT MONTH"

Notes to myself: research completed possible approach Write My Own Shortcode

since the time that I originally posted I wrote a custom shortcode that is partially working. I need to modify it to pass the unique cat_name="TO BE PASSED IN". (something I've never done before).

add_shortcode("bsm_unique_course_event_stream","bsm_this_month_cal");
function bsm_this_month_cal($atts,$content =null){
    $first_day_this_month = date('m-01-Y');
    $temp =  "{$first_day_this_month}";
    $con = "[ai1ec view=\"agenda\" events_limit=\"5\" cat_name=\"metalsmithing-lvl-1\" display_filters=\"false\" exact_date=\"$temp\"]";

    return do_shortcode($con);
 }

1 Answer 1

0

you may just check source where this shortcode is being extracted and there you can write some custom code to get first of current month and use that instead of extracted variable of shortcode.

1
  • I'll dig into the source code... the functions.php custom shortcode did correctly display the date it was was buggy anyways as it was displaying the [ 'some text' ] on the content of page.
    – codeangler
    Commented Oct 21, 2016 at 17:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.