Home › Forums › Pro Themes › University Hub Pro › Upcoming events in News & Events section
Tagged: news
- This topic has 12 replies, 1 voice, and was last updated 5 months, 1 week ago by Kodak.
-
AuthorPosts
-
May 13, 2017 at 2:35 am #42454cbhs-sacramentoParticipant
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?
ThanksMay 15, 2017 at 2:22 am #42527wensolutionsKeymasterHello @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!!
May 15, 2017 at 1:03 pm #42566cbhs-sacramentoParticipantIt 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.May 16, 2017 at 12:34 am #42606wensolutionsKeymasterHello @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!!
November 17, 2017 at 12:05 am #58505NGUYEN DANG HIENParticipantDear sir/madam
I follow the step but it doesnt work. When I edit the post, no place to add time and day.
November 17, 2017 at 5:10 am #58524wensolutionsKeymasterHello @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.pngHope this helps .
Best Regards!!
November 17, 2017 at 10:21 am #58546NGUYEN DANG HIENParticipantDear 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.November 17, 2017 at 10:30 am #58547cbhs-sacramentoParticipantI 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!
November 19, 2017 at 11:19 am #58703NGUYEN DANG HIENParticipantDear 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
November 20, 2017 at 12:08 am #58726wensolutionsKeymasterHello @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!!
November 21, 2017 at 9:21 am #58843NGUYEN DANG HIENParticipantThank 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
November 21, 2017 at 10:55 pm #58884wensolutionsKeymasterHello @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!!
July 8, 2024 at 4:40 pm #196209KodakParticipantin News & Events section
Сan i make NOEvents only “News” row ? -
AuthorPosts
- You must be logged in to reply to this topic.