Site icon Hip-Hop Website Design and Development

Create Second Search Web page Just for Customized Submit Kind

I created a {custom} publish kind that won’t be displayed wherever on the location. Nonetheless, I need to entry the info from a search kind. As a result of there will likely be numerous pages, I must disable the publish kind from displaying up within the regular search and create a second search web page for under looking out the key phrase in {custom} publish varieties.

I’ve learn fairly a couple of pages and folks give totally different recommendation and typically say to keep away from sure capabilities, so I am undecided what’s the most up to date means to do that.

I began by chopping and pasting my “search.php” into 2 partial templates after which altering “search.php” to

<?php
if(isset($_GET['search-type'])) {
    $kind = $_GET['search-type'];
    if($kind == 'custom-post-type') {
        get_template_part('/partials/search-custom-post-type');

    } else{
        get_template_part('/partials/search-normal');
    }
}
else{
        get_template_part('/partials/search-normal');
    }
?>

I learn that I may add the next code and it will enable me to customise the search-custom-post-type.php

$args = array( 'post_type' => 'custom-post-type-name' );
$args = array_merge( $args, $wp_query->question );
query_posts( $args );

Nonetheless, this does not do something. The search remains to be the identical.