Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support angelo_nwl

    (@angelo_nwl)

    WP FullCalendar is fully integrated with Events Manager at the moment and I’m afraid that ACF is not currently possible aside from EM placeholders.

    https://wp-events-plugin.com/documentation/placeholders/

    @johnnyr209 Did you figured this out? I need to do something similar but cannot make it work.
    I have read someone made it work but the topic is closed so I cannot respond to this person.

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    You’d need to hook in via PHP to make this work.

    apply_filters(‘wpfc_ajax_post’, $item, $post);

    You can modify $item which is what’s passed to the calenader, a redaction of $post, which you can use to get ACF data.

    Thanks for the response!
    Can you elaborate a little bit more on this?
    I am not a pro in PHP and I really need to make this work.

    I only have one custom field with a date. Not a start and end date.
    I have tried to modify $item but cannot make it work.

    Thanks in advance!

    I changed the following:

    $post_date = substr($post->post_date, 0, 10);
    $post_timestamp = strtotime($post->post_date);

    to:

    //the metakey of my custom field is event_date_time
    $time_date = get_post_meta( $post->ID, 'event_date_time' );
    $post_date = substr($time_date, 0, 10);
    $post_timestamp = get_post_meta( $post->ID, 'event_date_time' );
    //the custom field is stored in the database in UNIX so did not use strtotime

    The fields are giving the same kind of results so figured it should work. But it did not because I think I also need to change the following:

    function wpfc_temp_filter_where( $where = '' ) {
        $where .= " AND post_date >= '".date("Y-m-d", $_REQUEST['start'])."' AND post_date < '".date("Y-m-d", $_REQUEST['end'])."'";
        return $where;
    }

    But I don’t understand this last piece of code.

    Can you help me out?

    Thread Starter johnnyr209

    (@johnnyr209)

    This is how I pulled the start and end date from ACF

    start: '<?php if(get_field('start_date'))
            {
                $s_date = DateTime::createFromFormat('Ymd', get_field('start_date'));
                echo $s_date->format('Y-m-d');
                echo 'T00:00:00';
            }
    ?>',
    end: '<?php if(get_field('end_date'))
            {
                $e_date = DateTime::createFromFormat('Ymd', get_field('end_date'));
                echo $e_date->format('Y-m-d');
                echo 'T12:00:00';
            }
    ?>',

    This is how I pulled the URL and Title from ACF

    <?php $program_title_area = get_field('program_title', $p->ID); ?>
    <?php $program_url_area = get_the_permalink($p->ID); ?>
    url: '<?php echo '' . $program_url_area . ''; ?>',
    title: '<?php echo '' . $program_title_area . ''; ?>',

    Sweet! I works! Thanks Johnny!
    Only thing that’s not showing up in the calendar is the time. Instead it displays ‘3p’/’4p’/etc. at the place where the time should be. I have no idea where this is coming from?

    For anyboady who is interested this is what I did.
    I changed this at #189:

    $post_date = substr($post->post_date, 0, 10);
    $post_timestamp = strtotime($post->post_date);

    To:

    //my custom field is event_date_time
    $time_date = get_field('event_date_time');
    $post_date = substr($time_date, 0, 10);
    $post_timestamp = strtotime($time_date);

    IMPORTANT NOTE: The formatting of the dates in your custom field need to be the same as the formattimg in the wp-fullcalendar.php

    I’m using a start and end date. But I’m having to add a day to the end date to get it to view properly. Any reason for that? My changes for that are below:

    $post_date = substr($post->post_date, 0, 10);
    $post_timestamp = strtotime($post->post_date);

    to

    $time_date = get_field('event_date');
    $endDate = get_field('end_date');
    $endDate += date_create($endDate);
    date_add($endDate, date_interval_create_from_date_string('+1 day'));
    $post_date = substr($time_date, 0, 10);
    $post_timestamp = strtotime($time_date);
    $end_timestamp = strtotime($endDate);

    And

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

    to

    $item = array (
    	"title" => $title,
    	"color" => $color,
    	"start" => date('Y-m-d\TH:i:s', $post_timestamp),
    	"end" => date('Y-m-d\TH:i:s', $end_timestamp),
    	"url" => get_permalink($post->ID),
    	'post_id' => $post->ID
    );
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Advanced Custom Fields’ is closed to new replies.