Custom Post Types and Posts are mixed
Custom Post Types and Posts are mixed
Custom Post Types and Posts are mixed
Try adding the return as well in the else{}, like this: function template_chooser($template) { global $wp_query; $post_type = get_query_var(‘post_type’); if( $wp_query->is_search && $post_type == ‘product’ ) { return locate_template(‘archive-products.php’); } else { $args = array_merge( $wp_query->query, array( ‘post_type’ => ‘post’ ) ); query_posts( $args ); return locate_template(‘archive-products.php’); } return $template; } add_filter(‘template_include’, ‘template_chooser’); Haven’t tested.
if you are not taking care about backward compatibility (works only when run under PHP 5.3 and later), you can employ the anonymous function: add_action( ‘init’, function() { $pluralName=”PluralName”; $singularName=”SingularName”; custom_poster( $pluralName, $singularName ); } ); Or closure $singularName=”Singular Name”; $pluralName=”Plural Name”; add_action( ‘init’, function() use ($singularName, $pluralName) { custom_poster( $pluralName, $singularName ); } );
It looks to me like you’re trying to achieve a filtering mechanism, is that right? – by which users can see a list of products which match the set of criteria they give in the drop-downs. If that is the case, and although I haven’t any experience of doing this precise thing myself, a plugin … Read more
For normal posts you can set the permalink structure on Settings → Permalinks. All details can be found in the Codex For custom post types you can set the slug when you registering it: add_action( ‘init’, ‘create_posttype’ ); function create_posttype() { register_post_type( ‘cpost’, array( ‘labels’ => array( ‘name’ => __( ‘cpost’ ), ‘singular_name’ => __( … Read more
Find <div id=tab2_login” and replace it with following code.Assuming you will change CSS and JS accordingly. <div id=”tab2_login” class=”tab_content_login” style=”display:none;”> <h3>Register for this site!</h3> <p>Sign up now for the good stuff.</p> <form method=”post” action=”<?php echo site_url(‘wp-login.php?action=register’, ‘login_post’) ?>” class=”wp-user-form”> <div class=”username”> <label for=”user_login”><?php _e(‘Username’); ?>: </label> <input type=”text” name=”user_login” value=”<?php echo esc_attr(stripslashes($user_login)); ?>” size=”20″ id=”user_login” … Read more
Ok, so it turns out this was simply a case of going to Settings > Permalinks and merely saving. This reset the permalink structures.
Adding here. register_post_type function have a parameter public which controls how the type is visible to authors and readers. If public parameter of a post type is true then post type will be exclude_from_search, publicly_queryable, show_in_nav_menus, and show_ui. Read more about it in register_post_type function. Also all post types must be registered to use in … Read more
You can copy / paste archives.php and rename it archives-your_custom_post_slug.php this can help your thème to retrieve your custom tax.
The answer to your question is dependent upon your hosting environment (IIS, nginx, Apache, etc.). In a nutshell, you are looking to perform a redirect while preserving the original query. Consider https://serverfault.com/a/548595 for an example of one such redirect being performed within nginx.