- This topic has 27 replies, 5 voices, and was last updated 3 years, 11 months ago by Leo.
-
AuthorPosts
-
September 26, 2017 at 1:17 am #392053themedleb
I tested it and it worked (You missed the closing of the 8th line though).
Thank you.
September 26, 2017 at 8:05 am #392274TomLead DeveloperLead DeveloperAwesome!
Technically it doesn’t need an opening or closing as it’s a one line conditional, but I’ve added it in there for good coding standards ๐
September 26, 2017 at 3:12 pm #392511themedlebOkay, just because I tried to put the code on the “Snippet” plugin, and after clicking on the “Save changes” button this appeared:
Don’t Panic
The code snippet you are trying to save produced a fatal error on line 8:
syntax error, unexpected ‘;’, expecting ‘,’ or ‘)’
The previous version of the snippet is unchanged, and the rest of this site should be functioning normally as before.Please use the back button in your browser to return to the previous page and try to fix the code error. If you prefer, you can close this page and discard the changes you just made. No changes will be made to this site.
Anyway, thank you so much for your help and support, never thought I could make such things with your product/products.
September 26, 2017 at 7:42 pm #392578LeoStaffCustomer SupportLooks like it’s missing a closing bracket.
I’ve edited it. Try it again ๐
September 26, 2017 at 8:21 pm #392597themedlebI did thank you.
September 26, 2017 at 10:08 pm #392634LeoStaffCustomer SupportNo problem!
May 17, 2018 at 10:30 pm #578555DamonThis looks really close. Only issue I see is that this is happening on the author page, when there are no posts there. So there are in fact posts. Just none showing on the author page.
May 18, 2018 at 9:03 am #578955LeoStaffCustomer SupportHi Damon,
Not quite sure what you mean.
Any chance you can open a new topic and provide a link to your site with a bit more details?
Thanks!
May 18, 2018 at 9:56 am #578995DamonThank you Tom. That code is close, but not quite working since this is an author page. I’m guessing this is because there are in fact posts, but none yet by this author.
Here’s the page, until the author creates a first post:
https://www.dropbox.com/s/h0xjsrcuo1xtkhm/1.png?dl=0Here’s the page after the first post:
https://www.dropbox.com/s/gcvlipa0l2a34k8/2.png?dl=0I’m trying to redirect that first confusing page to another page that has instructions for creating a first post.
May 18, 2018 at 10:18 am #579014LeoStaffCustomer SupportHi Damon,
I don’t think you are replying to the correct post here.
May 18, 2018 at 10:52 am #579044DamonAck, sorry about that. Yes, please close this topic.
April 29, 2020 at 5:26 am #1261021Alain AubryThank you, this helped to sort a similar situation, related to a specific CPT
// Redirect 404 errors of specific CPT "eventos" add_action( 'template_redirect', 'tu_redirect_no_results' ); function tu_redirect_no_results() { global $wp_query; if ( 0 === $wp_query->post_count && $wp_query->query['post_type'] == 'evento' ) { wp_redirect( site_url( '/sem-eventos' ) ); } }
I am talking of this: https://generatepress.com/forums/topic/logo-on-mobile-menu/#post-392010
April 29, 2020 at 9:27 am #1261551LeoStaffCustomer SupportThanks for sharing your solution!
-
AuthorPosts
- You must be logged in to reply to this topic.