Removing Author & Post Date from Events in WordPress Search Results

Home Forums Calendar Products Events Calendar PRO Removing Author & Post Date from Events in WordPress Search Results

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1418041
    techwizard
    Participant

    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=steps

    This 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.

    #1418479
    Crisoforo
    Keymaster

    Hey!

    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,
    Crisoforo

    #1418521
    techwizard
    Participant

    Hi 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?

    #1418525
    Crisoforo
    Keymaster

    Hey!

    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,
    Crisoforo

    #1419274
    techwizard
    Participant

    Thanks 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?

    #1419286
    Crisoforo
    Keymaster

    Sure.

    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,
    Crisoforo

    #1437941
    Support Droid
    Keymaster

    Hey 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

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Removing Author & Post Date from Events in WordPress Search Results’ is closed to new replies.