Showing events in recent_posts

Home Forums Calendar Products Events Calendar PRO Showing events in recent_posts

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1252946
    Suzanne
    Participant

    Hi there-

    I am trying to include events from the Events Calendar on my homepage. The theme I am using is “Prosperity”. The theme uses “recent_posts” to display new blog posts on the homepage.

    – I updated my settings in the events calendar to “Include events in main blog loop”
    – I added code to my child theme to merge the events into the main rss feed (which seems to work)
    https://theeventscalendar.com/knowledgebase/customize-rss-feed/

    My thought was that I needed to update the “post_type” in my php file for the theme to incorporate “tribe_events” in addition to “post” but so far I’ve had no luck.

    $recent_args = array(
    ‘post_type’ => ‘post’,’tribe_events’,
    ‘posts_per_page’ => absint( get_theme_mod( ‘prosperity_front_recent_posts_number’, ‘6’ ) ),
    ‘ignore_sticky_posts’ => 1,
    ‘no_found_rows’ => true,

    here is the PHP code from the template that generates recent posts.

    $recent_posts = new WP_Query( $recent_args );

    if ( $recent_posts->have_posts() ) : ?>

    <section class=”front-block front-blog-posts”>
    <div class=”container”>

    <?php if ( ” != $section_title || ” != $section_content ) : ?>
    <div class=”front-block-header”>
    <?php if ( ” != $section_title ) : ?>

    <?php echo esc_html( $section_title ); ?>

    <?php endif; ?>

    <?php if ( ” != $section_content ) : ?>
    <div class=”front-block-content”>
    <?php echo convert_chars( wptexturize( stripslashes( wp_filter_post_kses( addslashes( $section_content ) ) ) ) ); // WPCS: XSS OK. ?>
    </div><!– .front-block-content –>
    <?php endif; ?>
    </div><!– .front-block-header –>
    <?php endif; ?>

    <div class=”row recent-posts-row”>
    <?php while ( $recent_posts->have_posts() ) : $recent_posts->the_post(); ?>

    <div class=”col-lg-4 recent-post”>
    <?php get_template_part( ‘template-parts/front-page/content/recent’, ‘post’ ); ?>
    </div><!– .recent-post –>

    <?php endwhile; ?>
    </div><!– .row.recent-posts-row –>

    <?php wp_reset_postdata(); ?>

    do you have any guidance on how I might proceed?

    Thank you,

    #1253411
    George
    Participant

    Hi there,

    We cannot help with any custom coding as elaborated upon here: https://theeventscalendar.com/knowledgebase/what-support-is-provided-for-license-holders/

    ⚠️ Please read that guide before responding!

    With those rules in mind, then, to get your custom homepage ideas working as you want, you would have to figure out your own custom coding and troubleshoot issues with it yourself, or would have to hire a professional developer to do it for you.

    We have a list of great developers here → http://m.tri.be/18k1 (and have no affiliation with any of these folks—they’re simply some well-respected names in the community that we’ve compiled to share in situations like this one).

    I am sorry about the fact that we cannot help here, but wish you the best of luck with your customizations.

    Sincerely,
    George

    #1253413
    George
    Participant

    While the above information is true, before I close this thread I did want to at least try and help, @Suzanne! 😀


    One Suggestion That Might Help

    I noticed in the custom code you posted this line of code:

    ‘post_type’ => ‘post’,’tribe_events’,

    While this is just a simple suggestion, it may really make a difference: try using an array for those options, instead of what you currently have.

    So try tweaking the code to this:

    'post_type' => array( 'post', 'tribe_events' ),

    ☝️ This seems like a small change but might help! 😀

    Just wanted to try and share something useful, because I am sorry that we can’t help more here—I hope this information helps a bit!

    Cheers,
    George

    #1254843
    Suzanne
    Participant

    Thanks very much for your assistance. This helped me quite a bit.

    #1255093
    George
    Participant

    Sure thing — best of luck with your customizations! 😀

    — George

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Showing events in recent_posts’ is closed to new replies.