Home Forums Pro Themes University Hub Pro Upcoming events in News & Events section

Tagged: 

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #42454
    cbhs-sacramento
    Participant

    I am trying to get the theme to show upcoming events in the themes news & events section. I noticed that the theme only shows current ‘Published’ events and not ‘Scheduled’. In searching the forums I tried to follow the recommendations of the in the university-hub NON-PRO version and it doesn’t work for the pro version. I also tried the Event Calendar plugin that was suggested and this dont show up either in the news & events area. Is there a possible work around to get this working?
    Thanks

    #42527
    wensolutions
    Keymaster

    Hello @cbhs-sacramento,

    The feature of showing the upcoming event is not in the theme .

    However you can achieve what you want by creating the child theme.

    Child theme references:https://codex.wordpress.org/Child_Themes

    You can also create the child theme using the plugin . Below is the link to one of them.

    https://wordpress.org/plugins/wp-child-theme-generator/

    After activating the child theme in your child theme create the folder template-parts. Then create the folder home inside the folder template-parts. Finally create the file news-and-events.php inside the home folder. After this paste below given code in news-and-events.php file

    .https://gist.github.com/anonymous/f6adaf90a2ffaa8c357745d73098b150

    The order for creating the folder must be according to one we have mentioned .

    Hope this helps.

    Best Regards!!

    #42566
    cbhs-sacramento
    Participant

    It worked like a charm! Thank you : )

    Note.
    I had to add the 'post_status' => 'future', to the recent-news qargs to show the future events in the news section as well.

    #42606
    wensolutions
    Keymaster

    Hello @cbhs-sacramento,

    Nice to know that the problem has been solved. If there are any further query, then, please feel free to post them.

    We will really appreciate if you could help us too by rating our theme in WordPress repo here:-

    https://wordpress.org/support/view/theme-reviews/university-hub

    Thank you !!

    Best Regards!!

    #58505
    NGUYEN DANG HIEN
    Participant

    Dear sir/madam

    I follow the step but it doesnt work. When I edit the post, no place to add time and day.

    #58524
    wensolutions
    Keymaster

    Hello @dh201hy,

    When we checked the code locally it is working fine .

    You can edit the time from the publish box at the right hand side side of the post edit screen .

    Screen shot .
    https://image.prntscr.com/image/siNid8HaSo_Jcs-AtWQBNg.png

    Hope this helps .

    Best Regards!!

    #58546
    NGUYEN DANG HIEN
    Participant

    Dear Sir,
    The old post and current posts do not display, the “future posts” diplay but when click them, the link is 404. Because this is schedule post.

    #58547
    cbhs-sacramento
    Participant

    I had to add the following to the bottom of my child theme functions.php to resolve the 404 issue.

    /* Show future posts */
    function show_future_posts($posts)
    {
       global $wp_query, $wpdb;
       if(is_single() && $wp_query->post_count == 0)
       {
          $posts = $wpdb->get_results($wp_query->request);
       }
       return $posts;
    }
    add_filter('the_posts', 'show_future_posts');

    Hope this helps.

    Best Regards!

    #58703
    NGUYEN DANG HIEN
    Participant

    Dear Cbhs-Sacramento

    Thank you very much. I fixed 404 but how can keep the old posts in the line. This only display future posts.

    Anh how to fix the permalinks? Now future post like “?p=113” (113 is ID)

    Thank you

    #58726
    wensolutions
    Keymaster

    Hello @dh201hy,

    To fix the issue of the permalink paste below given code in your child theme functions.php file .

    function future_permalink( $permalink, $post, $leavename, $sample = false ) {
    	/* for filter recursion (infinite loop) */
    	static $recursing = false;
    
    	if ( empty( $post->ID ) ) {
    		return $permalink;
    	}
    
    	if ( !$recursing ) {
    		if ( isset( $post->post_status ) && ( 'future' === $post->post_status ) ) {
    			// set the post status to publish to get the 'publish' permalink
    			$post->post_status = 'publish';
    			$recursing = true;
    			return get_permalink( $post, $leavename ) ;
    		}
    	}
    
    	$recursing = false;
    	return $permalink;
    }

    Hope this helps .

    If you have any confusion further please let us know.

    Best Regards!!

    #58843
    NGUYEN DANG HIEN
    Participant

    Thank you for your support but it doesnt work.

    I think next version you should update this funtions. You should add “date” in the post like some event Plugin

    #58884
    wensolutions
    Keymaster

    Hello @dh201hy,

    We have provided the code checking it locally .

    So please make sure you have included the exact code we have provided in child theme functions.php file .

    Hope this helps .

    Best Regards!!

    #196209
    Kodak
    Participant

    in News & Events section
    Сan i make NOEvents only “News” row ?

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