• Resolved Loukas

    (@loupaok)


    Hi,

    I am trying in bricks builder to use your plugin.

    I have setup everything correct but not showing anything at Front end.

    I use the <?php $rrule = get_field(‘start_date’); ?> also i tried <?php get_field(‘start_date’); ? but nothing happen.

    Is there anything that i made wrong?

    This is the field in acf https://prnt.sc/FayVQPQ0ldp1

    Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Marc Bellêtre

    (@marcbelletre)

    Hi Loukas,

    This plugin has no feature to display anything on the front-end. Furthermore, the code you provided just stores the content of the field in a $rrule variable so it would not display anything anyway.

    I see you’re naming your field start_date so I’m assuming you want to show a single date. In that case this plugin would not make sense and you should use a single date field. Maybe with a bit more context I could try to help you?

    Cheers,
    Marc

    Thread Starter Loukas

    (@loupaok)

    Hello Marc,

    Thank you for your reply!

    I want to create recurring events. I have create the cards https://prnt.sc/xAqXcA-i0Qyf and in the field that i show you i would like to show the existing day or days.

    The reason that i named the field like this is i want hide the past events. But i can change from start_date to rrule if that is a problem.

    Does your plugin show only 1 day only or show all days?

    Could you help me how can i print at front end the Date or the dates?

    Regards

    Loukas

    Plugin Author Marc Bellêtre

    (@marcbelletre)

    Hi,

    Ok I just wanted to make sure you were on the right track. If you want to create recurring events then this plugin should be what you need but keep in mind that this plugin just provides the field to store the RRULE string in database and retrieve the individual dates. It does not display anything.

    If you want to show every single date then you will have to loop through the dates like this (assuming your field is named start_date):

    <?php $rrule = get_field('start_date'); ?>
    
    <ul>
        <?php foreach ($rrule['dates_collection'] as $date) : ?>
            <li><?= $date->format('Y-m-d') ?></li>
        <?php endforeach; ?>
    </ul>

    For more information about the attributes that are returned by the RRule field you can check the readme from the GitHub repository.

    Thread Starter Loukas

    (@loupaok)

    Hi Mark,

    Now show every date, but is possible to show only the entire date and then the new one at the end of the event?

    Thanks

    Plugin Author Marc Bellêtre

    (@marcbelletre)

    What do you mean the entire date? If you want to show the first and last occurrences you can use the first_date and last_date attributes.

    <?php 
    $rrule = get_field('start_date'); 
    
    if ($rrule['last_date']) {
        $string = "From {$rrule['first_date']} to {$rrule['last_date']}";
    } else {
        $string = "From {$rrule['first_date']}";
    }
    ?>

    You can also use the text attribute that retrieves a human-readable representation of the recurrence like “Every monday starting July 1st”.

    Thread Starter Loukas

    (@loupaok)

    Hi Mar,

    Sorry, it was my mistake.

    I meant the specific date of the event, and when it’s over show me the next one.

    For example, if we have 11/4/2024 and 15/4/2024, it will show me the latest date of the event and then after it’s finished, it will show me the next one which is 15/4/2024

    Regards

    Plugin Author Marc Bellêtre

    (@marcbelletre)

    There is no built-in function to do what you want but it is definitely something you can implement yourself.

    I wrote an “advanced usage” guide to show an example of how you can create an agenda view here.

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

The topic ‘Not work the get_field’ is closed to new replies.