how to interconnect custom post types?
You only need to define two post types: ‘piece’ and ‘person’ and a connection field ‘role’. See https://github.com/scribu/wp-posts-to-posts/wiki/Connection-information
You only need to define two post types: ‘piece’ and ‘person’ and a connection field ‘role’. See https://github.com/scribu/wp-posts-to-posts/wiki/Connection-information
A Note: Actions and Filters are not really interchangeable: Filters typically must return the passed data or it’s going to break something. Building off of what m0r7if3r said, wp_insert_post_data is a filter, so you should be modifying the post’s $data and returning it at the end of the function. (Alternatively, you could global the variables … Read more
With the help of @toscho pointing out get_post();, I was able to spit out a .csv with a blank template. At first, I had memory limit issues b/c of the amount of data, so I moved the site locally and was able to get everything I need with the get_post(); This is the gist of … Read more
After reviewing your code there are a couple of things you need to change depending on where the meta content is being held. If you try $meta = get_post_meta( get_the_ID(), ‘custom_text’, TRUE ); echo ‘The meta content is: ‘ . $meta;` That should give you the appropriate meta. You are calling this function on the … Read more
UPDATE I did not test this method, but it is not very old. It adds custom meta information to the caption section of the image, which can then be styled as needed. Again, I did not try the method, and I am not a coder, but from reading through the tutorial, it sounds like it … Read more
There are several issues with your code. Let’s start at the beginning… Adding hooks All your hooks will be added at the backend. Even those which are outside the if((is_admin)) branch. Add your hooks explicitly where they should work: if (is_admin()){ // do this on backend (admin side) /* load plugin functions */ add_action(‘add_meta_boxes’, ‘myplugin_add_meta_box’); … Read more
$parent_post is an object, update_post_meta requires the ID, so should be: update_post_meta( $parent_post->ID, ‘average_wr’, $commentdata );
Actually, you’re a mistaken on a couple of points here. 1. Don’t use query_posts() This function is meant for modifying an existing query, not performing a standalone query. You should either use get_posts() or a new instance of the WP_Query() class to perform your query for the custom loop. Here’s some further reading on query_posts(): … Read more
No, to be honest 35 is nothing. You should not see any problems scaling this into the hundreds/thousands if optimized right, it does depend on many factors. Where is the post meta being used, are you sure it’s all being used? Are you using a lot of unique keys? You can check this by doing … Read more
Hook into save_post, count the words, and update the post meta field. Sample code, not tested: add_action( ‘save_post’, ‘wpse_73563_save_word_count’, 10, 2 ); function wpse_73563_save_word_count( $post_ID, $post ) { if ( ! current_user_can( ‘edit_’ . $_POST[‘post_type’], $post_ID ) ) { return FALSE; } $count = t5_word_count( $post->post_content ); update_post_meta( $post_ID, ‘_word_count’, ( 200 > $count ? … Read more