Do not show Projects page

Hey guys,

is it possible to hide the /projects - site itself? I want to show the projects with the widgets on other pages. But I don’t want to make the projects-page itself visible for the user.

If not: Is it possible to make this page full width (no sidebar)?

Thanks in advance.

Cheers
Charly

Hello Charly,

You could probably redirect it to another page or your site’s homepage. It can be done by adding the below snippet to your child theme’s functions.

add_action('pre_get_posts', 'sydney_pro_child_change_projects_order', 9999);
function sydney_pro_child_change_projects_order($query) {

  if( !is_admin() && is_archive() && is_main_query() && $query->query_vars['post_type'] =='projects' ) {
    wp_redirect( 'https://yoursite.com/' );
    exit;
  }

}

If you don’t have active child theme, alternatively you can use a plugin that allows the same purpose like Code Snippets or Functionality.

Regards,
Kharis

Thank you very much, Kharis. That worked, as expected :wink:

You’re welcome!

Please let us know in a new topic if you have any further questions, or if we can provide you with any other assistance.

Regards,
Kharis