Home › Forums › Calendar Products › Events Calendar PRO › Removing Author & Post Date from Events in WordPress Search Results
- This topic has 7 replies, 2 voices, and was last updated 6 years, 3 months ago by techwizard.
-
AuthorPosts
-
January 4, 2018 at 8:43 am #1418041techwizardParticipant
From my understanding, it seems that WordPress sees Events as posts. When using the WordPress search, it displays Events in this manner and includes the author and publishing date as shown here:
http://midland-ancestors.org/?s=stepsThis information is not relevant to that event, is there a way to display the Event Date & time instead of the author & publishing date?
Thank you,
Richard.January 4, 2018 at 6:00 pm #1418479CrisoforoKeymasterHey!
Thanks for reaching out.
That’s correct under the hood Events are a custom Post Type but are stored as Post on WordPress. On the other hand you can customize how events or any other post are displayed on the search you can edit the file search.php on your theme to change the output of every item.
On that file you can see a a piece of code like this one:
<?php while ( have_posts() ) : the_post(); ?><?php get_template_part( 'content', 'page' ); ?>
<?php comments_template( '', true ); ?>
<?php endwhile; // end of the loop. ?>
But it might be a slightly different depend on your theme, also depends on your theme it might not have a search.php file it will use the index.php file instead.
Please let me know if you have any other questions about this or if there is anything else I can do for you.
Thanks,
CrisoforoJanuary 4, 2018 at 6:55 pm #1418521techwizardParticipantHi Crisoforo, thanks for taking the time to respond.
I’m using the Genesis Framework, there is a search.php in the parent theme, but I don’t want to edit this. Presumably I can make a copy of it in the child theme and it will use the code there by default?
How would I refer specifically to a calendar event rather than all posts and return the event date here?
January 4, 2018 at 7:12 pm #1418525CrisoforoKeymasterHey!
Thanks for the details of your theme. And that’s correct going into the child theme approach seems like the best option, you can use the guide provided by your theme devs. In terms of your second question you can use the following snippet of code to test if a post is an event.
<?php
if ( "tribe_events" === get_post_type( get_the_ID() ) ) {
// Do something is an event post type.
}
?>
Another way you can approach this is by using CSS to hide parts of the section as all items that are events has a CSS class which is:
type-tribe_events
Please let me know if you have any other questions about this or if there is anything else I can do for you.
Thanks,
CrisoforoJanuary 5, 2018 at 3:27 pm #1419274techwizardParticipantThanks for your help, that information is useful. So, referring to the second part of my question, how can I extract the event date and display it in place of the author/publishing date?
January 5, 2018 at 4:14 pm #1419286CrisoforoKeymasterSure.
You need to look on your child theme for the instances or the place where you want to display the information of the author and use the following snipped of code instead this will display the details of the event as well with the cost if any.
<?php $event_id = get_the_ID(); ?>
<div class="tribe-events-schedule tribe-clearfix">
<?php echo tribe_events_event_schedule_details( $event_id, '<h2>', '</h2>' ); ?>
<?php if ( tribe_get_cost() ) : ?>
<span class="tribe-events-cost"><?php echo tribe_get_cost( null, true ) ?></span>
<?php endif; ?>
</div>
We have a detailed guide in how to customize the views of the plugin this will provide you a better insights in how to continue but if not let me know if you have any other questions.
Thanks,
CrisoforoJanuary 27, 2018 at 8:36 am #1437941Support DroidKeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
AuthorPosts
- The topic ‘Removing Author & Post Date from Events in WordPress Search Results’ is closed to new replies.