Drop Down Filter with CPT as Options for Search Form

use for search this form with custom post type list <form role=”search” method=”get” id=”searchform” action=”<?php echo home_url( “https://wordpress.stackexchange.com/” ); ?>”> <input type=”text” name=”s” id=”s” value=”Enter keywords …” onfocus=”if(this.value==this.defaultValue)this.value=””;” onblur=”if(this.value==”)this.value=this.defaultValue;”/><br /> <?php $types = get_post_types(); ?> <select name=”posttype”> <?php foreach ( $types as $type ) {?> <option name=”<?php echo $type->singular_label ; ?>” value=”<?php echo $type->singular_label ; … Read more

Custom Post Types on Custom Categories

Let’s go. First, create your custom post type (products): add_action( ‘init’, ‘add_post_type_products’ ); function add_post_type_products() { $labels = array( ‘menu_name’ => _x(‘Products’, ‘your_text_domain’), // the menu name text. This string is the name to give menu items. Defaults to value of name ‘name’ => _x(‘Products’, ‘post type general name’, ‘your_text_domain’), // general name, usually plural. … Read more

my custom_post_type does not appear in my web page…how?

It sounds like you want to hook into pre_get_posts for the blog index. The following should only effect the blog index. That is what is_home() is for. Of course, you can edit the function to alter that behavior if you want. function add_post_type_to_index_wpse_88317($qry) { if (is_home()) { $qry->set(‘post_type’,array(‘post’,’movies_cp’)); // plus any others you want. } … Read more