• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Add Events to homepage

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Add Events to homepage

This topic is: not resolved

Tagged: events, homepage

  • This topic has 3 replies, 2 voices, and was last updated 11 years, 11 months ago by Brad Dalton.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • May 10, 2014 at 9:52 pm #104503
    jholcombkw
    Member

    I have been trying to add some events (Events with Cat=1) to the homepage with posts. I add code-

    
    add_filter( 'pre_get_posts', 'my_get_posts' );
    
    function my_get_posts( $query ) {
    
    	if ( is_home() && false == $query->query_vars['suppress_filters'] )
    		$query->set( 'post_type', array( 'post', 'event' ) );
    
    	return $query;
    }
    

    to my function.php file, which will add events to the homepage, but it will not filter them and it also takes my filter off my posts.

    My current code is

    
    /*** Custom Post Byline */
    function custom_post_info($post_info)  {
    	$post_info = 'By [post_author_posts_link]';
    	if (!is_single()) { $post_info .= '<a href="' . get_comments_link() . '">Leave a Comment</a>'; }
    	$post_info .= '<div class="post-date"><span class="month">[post_date format="M"]</span><span class="day">[post_date format="j"]</span>[post_comments zero="0" one="1" more="%"]</div>';
    	return $post_info;
    	}
    add_filter('genesis_post_info','custom_post_info',40);
    add_filter('genesis_post_info','do_shortcode',40);
    

    home.php code is:

    
    <?php
    remove_action( 'genesis_loop', 'genesis_do_loop' );
    add_action( 'genesis_loop', 'child_grid_loop_helper' );
    /** Add support for Genesis Grid Loop **/
    function child_grid_loop_helper() {
    
    	if ( function_exists( 'genesis_grid_loop' ) ) {
    		remove_action( 'genesis_before_post_content', 'generate_post_image', 5 );
    		genesis_grid_loop( array(
    			'cat'                   => 1,
    			'features'              => 1,
    			'feature_content_limit' => 0,
    			'grid_image_size'       => '',
    			'grid_content_limit'    => 0,
    			'more'                  => __('Continue','inspyr'),
    
    		) );
    	} else {
    		genesis_standard_loop();
    	}
    
    }
    
    genesis();
    

    Thanks you for your time.

    May 11, 2014 at 12:11 am #104507
    Brad Dalton
    Participant

    Whats the code for your custom post type or is it a plugin which generates the CPT?


    Tutorials for StudioPress Themes.

    July 6, 2014 at 1:11 pm #113143
    jholcombkw
    Member

    I am using the Plugin called Events Manager, which generates the CPT.

    Events Manager – Calendar, Bookings, Tickets, and more!

    July 7, 2014 at 12:55 am #113179
    Brad Dalton
    Participant

    I would ask the plugin Developer how to do this.

    If it was code included in your theme which generated the CPT then i could help.


    Tutorials for StudioPress Themes.

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble