Hide Pages from Search Results in WordPress
In WordPress by default both posts and pages are included in the Search Results, you can remove pages or posts for that matter and also include custom post types by using the action hook pre_get_posts. In your functions.php add the appropriate snippet; To remove pages from the search results add in… To remove posts from the…
Read MoreShow Custom Post Types in Category Archive Page
By default WordPress custom post types do not appear in a category or tag archive page, to change this behaviour and display the custom post type you can add this filter/function to your themes functions.php file. function themeprefix_show_cpt_archives( $query ) { if( is_category() || is_tag() && empty( $query->query_vars[‘suppress_filters’] ) ) { $query->set( ‘post_type’, array( ‘post’, ‘nav_menu_item’, ‘custom-post-type-name’…
Read MoreAdd Custom Taxonomy Post Meta Terms to Custom Post Type in Genesis WordPress
To add in the post meta of custom taxonomy terms into custom post types in Genesis WordPress theme you need to create a function with a conditional that equals the custom post type then set the post meta using shortcode which includes the taxonomy terms, then apply a filter to the result to the genesis_post_meta function in your functions.php file. You can choose to…
Read MoreSet a Sidebar to all posts of a Custom Post Type in Genesis
Simple Sidebars is a great plugin to use different sidebars on posts, pages, categories and tags in a Genesis theme. You can set a certain sidebar to appear on all posts of a specific custom post type (CPT). function themeprefix_remove_default_sidebar() { if ( get_post_type() == ‘listing’ ) { //set CPT here remove_action( ‘genesis_sidebar’, ‘ss_do_sidebar’ ); remove_action(…
Read MoreList all WordPress Custom Post Types in a Menu
Want to display a list of a certain WordPress Custom Post Types in a list or menu? You can do this with a simple query using WP Query. WP Query is the preferred function to query all posts in WordPress and has a multitude of arguments and parameters that can be passed in to change…
Read MoreAdding a Dashicon to a Custom Post Type in WordPress
Once you have Custom Post Types set up and available via the WordPress Dashboard you can assign a Dashicon to them , these are the icons fonts already loaded and in use in the WordPress Dashboard. Selection of the icon can be done here. So in the above example, I have chosen the person icon…
Read MoreMoving Custom Post Types Higher Up the Admin Menu in WordPress Dashboard
You can move any custom post type icon higher up in the Admin Dashboard of the WordPress backend, by doing this you make the positioning more user friendly and intuitive to an end user. By default any new custom post types appear below the ‘Comments’ link, in the above example ‘Tax Liens’ is a new…
Read MoreCreate Custom Post Types in Genesis Child Theme in WordPress
Custom Post Types are a great way to structure your data and also to provide an interface for an end user to easily populate data as in any content management system. There are WP plugins available for download that can create and manage custom post types but you can also follow WordPress functions and do…
Read More