Have custom post type Visibility be private by default, and have radio button also set to “Private”

Actually all you have to do is changing the script part to this: <script type=”text/javascript”> (function($){ try { $(‘#post-visibility-display’).text(‘<?php echo $visibility_trans; ?>’); $(‘#hidden-post-visibility’).val(‘<?php echo $visibility; ?>’); $(‘#visibility-radio-<?php echo $visibility; ?>’).attr(‘checked’, true); } catch(err){} }) (jQuery); </script> You see there is an additional line compared to your code. I’m referring you to my original answer for … Read more

How to import database table as custom post type and custom fields?

// There’s a confusion in which method you are importing your external table into WordPress. If someway you have parsed you external table data into a PHP variable ex: $data, then it would be simple to import. foreach( $data as $_dt ) { $new_id = wp_insert_post( array( ‘post_type’ => ‘vehicle’, ‘post_status’ => ‘publish’, ‘post_title’ => … Read more

Modifying Dashboard edit.php

You could edit the columns for your CPT like so: function edit_cpt_columns($columns){ $columns = array( ‘cb’ => ‘<input type=”checkbox” />’, ‘title’ => __(‘Post’) ); return $columns; } add_filter(‘manage_edit-CPT_columns’, ‘edit_cpt_columns’); function manage_cpt_columns( $column, $post_id ) { global $post; switch( $column ) { case ‘title’ : $link = get_permalink($post->ID); echo ‘<a href=”‘.$link'”>’.$post->post_excerpt.'</a>’; break; default : break; } … Read more

Compare Two Custom Post Types Using The Same Custom Taxonomy

Don’t use get_the_term_list() as it returns an HTML string, which makes comparing more difficult. Use wp_get_post_terms() (Codex link) instead. It can return an array, and then you can use something like array_intersect() to get the terms that match. Your code should look something like this (I haven’t tested this): $course_terms = wp_get_post_terms($course_post_id, ‘course_type’. array(‘fields’=>’slug’)); $testimonial_terms … Read more

Sort column on meta key and meta value

Have you tried changing your orderby value to meta_value, rather than meta_value_num in your status_column_orderby function? This has always worked for me in the past. I’m assuming we are dealing with words, not numbers, since you said “alphabetically” in your question. meta_value is for letters/characters, with meta_value_num reserved for… you guessed it… numbers.

Modify a plugin function output from another plugin

I will never understand the point of these wildly complicated “helper” wrapper/plugins… but that aside… The plugin provides a lot of filters that might help you out. I think that the types_view filter might be what you want. Something like this is a plugin file or your theme functions.php might do it: add_filter(‘types_view’,’do_shortcode’); I do … Read more

how to redirect to a custom post template

If you CPT is called “work“, i.e. you have registered it using register_post_type(‘work’, $args); you have to create a file called ‘single-work.php’ and that will be used to show the singular work post. If you don’t create that file the file ‘single.php’,if present, will be used by WordPress. If even the ‘single.php’ does not exist … Read more