Assign category a default post type

I’m also wanting the post to be assigned the post type “Video”. You can’t just change a post to a different Post Type. There is a difference between “Post Type” and “Post Format”. From your examples I assume you would like to change the “Post Format”, as per the codex http://codex.wordpress.org/Function_Reference/set_post_format, you would need to … Read more

Excerpt function for any content

I think that the function you need is wp_trim_excerpt. With this function you can generate a excerpt from any text: $text = “Some context”; $excerpt = wp_trim_excerpt( $text ); It is important to note that wp_trim_excerpt use the excerpt length set by WordPress, that is 55 words by default, and make use of excerpt_lenght filter, … Read more

Save and user submitted data from a form and display them in the wp backend

Can you just tell me how I can grab the input value for “name” and add the entry to custom_post_type? Sure thing: if ( isset( $_POST[‘name’] ) ) { $name = sanitize_text_field( wp_unslash( $_POST[‘name’] ) ); if ( $name ) { wp_insert_post( array( ‘post_title’ => $name, ‘post_type’ => ‘my_post_type’, ‘post_status’ => ‘publish’, /* Or “draft”, … Read more

How to display CPT archives?

Is the cooking blog under a CPT? In your CPT definition there is an argument to enable archives. See http://codex.wordpress.org/Function_Reference/register_post_type under “has_archive” That value will need to be set to true. After that, the CPT will be available at example.com/cpt-slug-here If you want to change that, you can set the value by overriding the rewrite … Read more