Forum Replies Created

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

    (@memerson)

    Thanks for your response. I have read the troubleshooting guide, and I have tried the SMTP method with no joy.

    I’ll install the logger you suggest and let you know.

    It’s definitely not the server – it’s dedicated and owned by myself, and they have told me that dedicated servers do not block port 25.

    EDIT:

    Got it working!

    Changed this line:

    $item = array ("title" => $title, "color" => $color, "start" => $post_date, "end" => $post_date, "url" => get_permalink($post->ID), 'post_id' => $post->ID );

    to this:

    $item = array ("title" => $title, "color" => $color, "start" => date('Y-m-d\TH:i:s', strtotime($post_date)), "end" => date('Y-m-d\TH:i:s', strtotime($post_date)), "url" => get_permalink($post->ID), 'post_id' => $post->ID );

    Forgot the fact that Full Calendar does require the ‘Y-m-d\TH:i:s’ format to work!

    Thanks for all the advice ??

    Thanks for the help.

    I did realise why something went wrong as the format of the course date in the database was not correct, so I changed it to the format yyyy-mm-dd and cut out the explode. I also cleaned up some of the other code and finally got the data out but it still does not show on the calendar.

    Here is the jSON returned from the query:

    [{"title":"Plant Supports","color":"#a8d144","start":"2016-08-06","end":"2016-08-06","url":"http:\/\/courses2.musgrovewillows.co.uk.172-24-16-212.mo-server6.co.uk\/product\/plant-supports-aug\/","post_id":100}]

    My $item array line is now:

    $item = array (“title” => $title, “color” => $color, “start” => $post_date, “end” => $post_date, “url” => get_permalink($post->ID), ‘post_id’ => $post->ID );

    (as you can see I have eliminated the date() formatting since it’s the correct format to begin with). I’ve commented out the $where as suggested and my new args are:

    $args = array(
        'posts_per_page' => -1,
        'post_type' => 'product',
        'meta_query' => array(
            array(
                'key' => '_course_date',
                'compare' => '<=',
                'value' => $_REQUEST['end'],
            ),
            array(
                'key' => '_course_date',
                'compare' => '>=', // Same as above
                'value' => $_REQUEST['start'],
            ),
        ),
    );

    So, basically, even though it retrieves the data, it does not display on the calendar – I’m sure I’m missing something really simple but I can’t see it…

    Thanks for the response.

    I’m using:

    $course_date = get_post_meta( $post->ID, '_course_date', true );
     $date_bits = explode("/",$course_date);
     $post_date = $date_bits[2] . '-' . $date_bits[1] .'-'. $date_bits[0];
     $post_timestamp = date("Y-m-d", strtotime($post_date));

    The meta _course_date comes out in the format 25/08/2016 (d/m/Y) which is why I use the explode to reformat the date to be able to process the timestamp.

    I don’t have a start and end date, just a single date – does this mean I need to refactor the $args to work correctly?

    Hi, I know this may have worked for you, but I’m trying to do something similar, I’ve got a WooCommerce store that ‘sells’ courses which have dates assigned to them. The dates are added to a custom field in the product page and I need this date to be the one on the calendar, NOT the post date. I’ve tried your solution but now nothing shows on the calendar – the only thing I’ve changed is the name of the meta field to mine – but I don’t understand where the $cmb_date_end and $cmb_date_start comes from? Or is it hard coded to the month you want to display (seems a bit silly?)

    Thanks

    Thread Starter memerson

    (@memerson)

    Thank you – although, why is it not set in the “orderby” argument? Surely the “order” argument just determines whether it’s ascending or descending?

Viewing 6 replies - 1 through 6 (of 6 total)