How do I set a default message when no events are scheduled?

Hello!

I am developing a website where the client will add events, but events will only offered sporadically. The default events page (http://www.jbwp.com/clients/slpa/events/) currently does not show any events since there are none upcoming. How do I place a default message when no events are scheduled? I'd love for it to say "There are currently no scheduled events or programs, please check back soon."

If I add the above text to the page using the WordPress editor it does not show up. Any suggestions?

Thank you,
Jason

  • Vinod Dalvi

    Hi @jbwebandphoto,

    I hope you are well today and thank you for your question.

    You can place a default message when no events are scheduled by copying events-and-bookings/default/archive-incsub_event.php file from Events+ plugin into you theme and then edit line number 11 with whatever message you want to display on events archive page when no events are scheduled as shown in the following code.

    Before Editing:

    <?php if ( !have_posts() ) : ?>
                        <p><?php $event_ptype = get_post_type_object( 'incsub_event' ); echo $event_ptype->labels->not_found; ?></p>
                    <?php else: ?>

    After Editing:

    <?php if ( !have_posts() ) : ?>
                        <p><?php _e( 'There are currently no scheduled events or programs, please check back soon.', Eab_EventsHub::TEXT_DOMAIN ); ?></p>
                    <?php else: ?>

    Best Regards,

  • Vaughan

    hiya

    copy the archive-incsub-events.php template from events-and-bookings/default-templates/default/

    into your current themes folder.

    then edit this file.

    find around line 11

    <p><?php $event_ptype = get_post_type_object( 'incsub_event' ); echo $event_ptype->labels->not_found; ?></p>

    add after so looks like this

    <p><?php $event_ptype = get_post_type_object( 'incsub_event' ); echo $event_ptype->labels->not_found; ?></p>
                        <p>There are currently no scheduled events or programs, please check back soon.</p>

    hope this helps

  • jbwebandphoto

    Thank you both for the quick responses! The solution you provide works - sort of.

    I use a theme builder called Headway, which you may have come across before. I have a child theme folder set up to place a custom functions.php file, so I placed the archive-incsub_event.php file into this folder.

    The result is the custom message appearing, but the theme formatting/design essentially gone for this particular page (http://www.jbwp.com/clients/slpa/events/). Any other suggestions?

    Thanks,
    Jason

  • Vinod Dalvi

    Hi @jbwebandphoto,

    I just checked it with WordPress default theme twentythirteen and it worked fine.

    Could you just check it once by using default theme. If it works fine with default theme it means it doesn't work with Headway theme builder, in that case we have to check whether Headway theme builder provides any option to configure it and if not then we have to edit code in archive-incsub_event.php file.

    Best Regards,

  • jbwebandphoto

    Hello,

    I checked with the default theme and it seems to work fine, so perhaps it doesn't like the Headway Theme builder. I've scoured the Headway Support pages in search of anything related to this plugin and was not able to find anything helpful.

    The Events plugin seems to "take over" the events sub-page - I tried inserting a custom code block alongside the main content area, and the custom code block did not show up on the page. Is there a way to disassociate the plugin from the /events page, and instead insert a shortcode on the Events page through the Wordpress page editor that will still allow the Events plugin to work?

    Thank you,
    Jason

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.