Make slug as ID Number for custom post types

Here’s a way how to change the slug: add_action(‘wp_insert_post’, ‘change_slug’); function change_slug( $post_id ) { // Making sure this runs only when a ‘eduation’ post type is created $slug = ‘eduation’; if ( $slug != $_POST[‘post_type’] ) { return; } wp_update_post( array( ‘ID’ => $post_id, ‘post_name’ => $post_id // slug )); }

Add Tags to custom post type

It seems the issue was in part down to their being a theme-init.php in the child theme which was overwritting parts of the theme-init.php in the parent / cherry framework theme. I resolved the issue by adding the following code into my child theme’s theme-init.php; register_taxonomy(‘team_tag’, ‘team’, array( ‘hierarchical’ => false, ‘label’ => theme_locals(“tags”), ‘singular_name’ … Read more

How to dynamically attach pictures to a carousel

It’s an interesting task. We can make a custom Slider Menu in Dashboard then featured images can be upload from there so that those images can be called dynamically in slider. First we have to make Theme Support and register Post Type in functions.php add_theme_support( ‘post-thumbnails’, array( ‘post’, ‘slider’ ) ); add_image_size( ‘slider-image’, 1024, 550, … Read more

Multiple custom post type loops in category.php

Solution: //make sure these custom post types are registered for taxonomy queries add_filter(‘pre_get_posts’, ‘query_post_type’); function query_post_type($query) { if(is_category() || is_tag()) { $post_type = get_query_var(‘post_type’); if($post_type) $post_type = $post_type; else $post_type = array(‘nav_menu_item’, ‘venue’, ‘story’); // don’t forget nav_menu_item to allow menus to work! $query->set(‘post_type’,$post_type); return $query; } } was filtering the results (before? after?) the … Read more