View difference between Paste ID: AvnJ7Ccn and a6TsNDic
SHOW: | | - or go back to the newest paste.
1
<?php
2
	/* this is the very beginning of the index.php */
3
4-
	* redirect when search & find is empty
4+
5
	* redirect when search & find is empty:
6
	* problem: under circumstances (querying by many parameters) there is an empty result and instead of the archive.php the index.php opens  
7
	* hacky solution: check for the parameter 'post_types' in the url on index.php and if found, redirect to the specific archive page
8
	* note: change the post_types var's to yours, change the url slug fitting your slugs
9-
	    	//echo 'pub';
9+
10
	if(isset($_GET['post_types'])) {
11
	    $var = $_GET['post_types'];
12-
	    	//echo 'pro';
12+
13
	    	wp_safe_redirect( ''.get_home_url().'/publication' ); exit;
14
	    }else if ($var == 'project'){
15
	    	wp_safe_redirect( ''.get_home_url().'/projects' ); exit;
16
	    }
17
	}