[Events +] Editing Events Main Page Shortcode?

Hello.
How do i amend the default event calendar page? The slug-root page is /events-calendar/ if i try and add the below short-code within that page there nothing happens.

This is short-code i would like to use is...
[eab_calendar with_thumbnail="yes" navigation="yes" footer="yes" short_title_format="d-m-Y" show_excerpt="yes"]

It works on another page i set it up on, but i want it to work on the default calendar page?

  • Adam Czajczyk

    Hello uol

    I hope you're well today and thank you for your question!

    The "default events page" is a "virtual" page so regardless of what shortcode you put on it, the plugin will generate its content anyway - using it's internal routines.

    The simplest way around this is to use a separate page for your shortcode and point visitors to that page but the downside would be that any link to "events list" created by plugin would still point to the "root page". To overcome that a small "trick" would work:

    1. create a simple custom page template; the simplest way to do it is to

    - copy "page.php" template file of your current theme to the "page-events.php" file;
    - edit the new ("page-events.php") file to give your custom template a name, e.g.:

    <?php
    /**
     * Template Name: Events Custom Page

    You will find more about creating custom page templates here:
    https://premium.wpmudev.org/blog/creating-custom-page-templates-in-wordpress/

    2. Once this is done, edit that new file again and look for a line where the content is being fetched; usually it would be similar to

    <?php the_content(); ?>

    or instead it might be calling a sub-template similarly to

    get_template_part( 'template-parts/page/content', 'page' );

    You would want to comment that out and instead put this line or entire WP Loop in your new template file and put this line instead:

    <?php
    echo do_shortcode('[eab_calendar with_thumbnail="yes" navigation="yes" footer="yes" short_title_format="d-m-Y" show_excerpt="yes"]');
    ?>

    Please note: the opening and closing PHP tag might or might not be necessary depending on how your page template is built.

    3. After that go to "Events -> Settings - Appearance settings" page
    - check the "Override default apperance?" checkbox
    - from "Archive template" select "Theme: Events Custom Page" (assuming that your new template was named "Events Custom Page")
    - save changes

    This way it will use your custom template for root events page and the custom template will simply execute your shortcode.

    If you have any additional questions, let me know please.

    Kind regards,
    Adam

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.