Home Forums Free Themes University Hub Homepage Events — displaying future events?

Tagged: ,

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #29867

    I see that the “events” section on the homepage is looking for Posts set to a specific category. However, it’s not possible to display future/upcoming events, since posts can only be public if they have already been published. Is there a way around this? Does us no good to display past events.

    #29923
    wensolutions
    Keymaster

    Hello @webmaster@govanquish.com,

    The feature to get the future events to display in the Events section is not yet available in the theme. The date displayed in the Event section for the posts is actually the post publish date for the post selected in the section.

    However, you can get the feature by modifying the posts query and setting the posts to “Scheduled” with child theme approach. To know more about child theme, see the link here : https://codex.wordpress.org/Child_Themes

    You can also automate the task with the help of Child theme generator plugin.

    After creating and activating the child theme, paste in the following block of code in your child theme’s functions.php file :

    function university_hub_get_home_sections_options() {
    
    		$choices = array(
    			'news-and-events' => array(
    				'label'    => __( 'News and Events', 'university-hub' ),
    				'template' => 'template-news-and-events',
    				),
    			'call-to-action' => array(
    				'label'    => __( 'Call To Action', 'university-hub' ),
    				'template' => 'template-parts/home/call-to-action',
    				),
    			'latest-news' => array(
    				'label'    => __( 'Latest News', 'university-hub' ),
    				'template' => 'template-parts/home/latest-news',
    				),
    			);
    		$output = apply_filters( 'university_hub_filter_home_sections_options', $choices );
    		return $output;
    
    	}

    You will then need to create a new file “template-news-and-events.php” in your child theme’s directory and paste in the code below in the file :

    This will let you pull the posts set as “Scheduled” from your posts that will allow you to add future events in the Events listing.

    Hope this Helps,

    Best Regards !!

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.