Inserting Event Description into Events Archive eab_archive Shortcode Output

I got as far as this post in trying to find an answer to this...and just need a little PHP help, I think.

Client wants the event description included in the output of the shortcode [eab_archive]. I see some code in class_eab_template.php around 83 and 84 which seems to grab the description?

How would I insert that into the shortcode output? I am pretty sure that the file to edit is shortcode-archive-default.php, but that's got some pretty encapsulated calls...anyway...help?

And, I am sure that with this info, I should be able to figure it out, but am still confused.

Thanks!

  • ken_lyle

    Yep, you got the mission...

    I would prefer an upgrade-safe solution, of course, if possible.

    I am pretty sure that Vlad has provided the keys in that last post I referenced, "By default, the shortcodes won't even bother with the templates, and will use the callbacks in the templating class instead "

    But I am just not sure how to put the pieces together.

    I'd rather not get into what appears to be relatively undocumented territory of modifying templates if I can hack two lines from one place to another...unless it's only a little more work to do something upgrade-safe and permanent.

    Thanks!

  • Hoang Ngo

    Hi @ken_lyle,

    I hope you are well today.

    For implement the custom template, please do it by those steps

    1. I assume that your short code is like this
    [eab_archive template="shortcode_archive"]
    So now, the template file name will be "shortcode_archive.php"
    2. Create a file with the name "shortcode_archive.php", and save in your theme folder.
    And then, please copy this code to the file you've just created

    <section class="eab-events-archive <?php esc_attr_e($args['class']); ?>">
    	<?php foreach ($events as $event) { ?>
    		<?php $event = $event instanceof Eab_EventModel ? $event : new Eab_EventModel($event); ?>
    		<article class="eab-event <?php echo eab_call_template('get_status_class', $event); ?>" id="eab-event-<?php echo $event->get_id(); ?>">
    			<h4><?php echo $event->get_title(); ?></h4>
    			<div class="eab-event-body">
    				<?php echo eab_call_template('get_archive_content', $event); ?>
    			</div>
    		</article>
    	<?php } ?>
    </section>

    Yah, now you have a custom event archive template, you can start to modify this for your purpose :slight_smile:.

    If you have any issues please don't hesitate to let us know so we can assist

    Best regards,
    Hoang

  • Hoang Ngo

    Hi @Wendie,

    I hope you are well today.

    Since this thread is old, so we can accident miss this. Can you please create another thread with your issue?

    Also, for your issue right now, look like a PHP error happened. Please enable the WP_DEBUG by open the file wp-config.php, find the line define( 'WP_DEBUG', false ); and update it to define( 'WP_DEBUG', true );. This will show us what's going on :slight_smile:

    Best regards,
    Hoang

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.