Add Events to homepage

Community Forums Forums General Discussion Add Events to homepage

This topic is: not resolved

Tagged: ,

This topic contains 3 replies, has 2 voices, and was last updated by  braddalton 2 months, 3 weeks ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #104503

    jholcombkw
    Member
    Post count: 10

    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.

    • This topic was modified 4 months, 3 weeks ago by  jholcombkw.
    • This topic was modified 4 months, 3 weeks ago by  jholcombkw.
    #104507

    braddalton
    Participant
    Post count: 9909

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


    #113143

    jholcombkw
    Member
    Post count: 10

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

    https://wordpress.org/plugins/events-manager/

    #113179

    braddalton
    Participant
    Post count: 9909

    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.


Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.