Plugin to auto convert custom fields to tag

Placing something like this in your functions.php should work. I haven’t had the opportunity to test this code yet and its a little messy (could be polished up) but should give you an very good starting point.. add_action(‘save_post’,’custom_field_add_tags’); function custom_field_add_tags($post_id) { $post = get_post($post_id); //get values of custom fields and put into array $tag1 = … Read more

Authors details such as social media links, emails etc → Is this Meta or something else?

Add user contact methods using the user_contactmethods filter in your theme’s functions.php or via a plugin: User contact method entries are stored in the wp_usermeta table. The URL field is special; it’s stored in the user_url field in the wp_users table. // Add user contact methods add_filter( ‘user_contactmethods’,’wpse_user_contactmethods’, 10, 1 ); function wpse_user_contactmethods( $contact_methods ) … Read more

How To Create a Metabox of HTML Content with Instructions For Editors When Editing a Post or Page?

Don’t know any plugin for that. But it can be solved creating a custom plugin with the Settings API and a Custom Meta Box. Adding a RichText Editor in the Settings Page /wp-admin/options-general.php <?php /* Plugin Name: Custom Editor in Settings Page */ add_action( ‘admin_init’, ‘register_settings_wpse_57647’ ); # Register settings function register_settings_wpse_57647() { register_setting( ‘general’, … Read more

Order posts by date and then by custom field

add_filter(‘posts_orderby’, ‘posts_orderby’); function posts_orderby($orderby_for_query) { global $wpdb; $prefix = $wpdb->prefix; $orderby_for_query = “LEFT(” . $prefix . “posts.post_date, 10) DESC, ” . $orderby_for_query; return $orderby_for_query; } This produces this query: SELECT wp_posts.* FROM wp_posts INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id) WHERE 1=1 AND wp_posts.post_type=”post” AND (wp_posts.post_status=”publish”) AND (wp_postmeta.meta_key = ‘my_post_rating’ ) GROUP BY wp_posts.ID ORDER … Read more

Adding a custom field into the_content()

Try the_content filter to append your field onto the content: function wpa_content_filter( $content ) { global $post; if( $meta = get_post_meta( $post->ID, ‘reviewGrade’, true ) ) { return $content . $meta; } return $content; } add_filter( ‘the_content’, ‘wpa_content_filter’, 10 ); Use the priority argument of add_filter to control the order in which your function runs.

Use WP 3.1 Internal Linking ‘widget’ as a meta_box

WordPress 3.1 Internal Linking feature was coded as a TinyMCE editor plugin so its not really a widget or a meta box but you can code your own meta box and reuse the functiona needed for that. The files you need to look at are /wp-includes/js/tinymce/wp-mce-link.php /wp-includes/js/tinymce/plugins/wplink/js/wplink.js and maybe a few more but these are … Read more

How can i create a function to get youtube video time

The following are the functions that I use to extract data from a YouTube response to wp_remote_get. It’s just the basic stuff, you’ll have to adjust, complement and integrate into your code. add_action( ‘save_post’, ‘brsfl_save_postdata’ ); function brsfl_save_postdata( $post_id ) { // IMPORTANT! // Check for DOING_AUTOSAVE and wp_verify_nonce() $consult = brsfl_yt_api( $_POST[‘yt_id’] ); if( … Read more