How can I programmatically save data into custom fields that contain serialized data?

For serializing and unserializing Data in WordPress, you can use maybe_unserialize and maybe_serialize. If you want to handle the data and add/change values, you could use something like this: $metaarray = maybe_unserialize(get_post_meta($post_id,’_ait-dir-item’,TRUE)); //now $metaarray has an array, if it is serialized. If not, $metaarray has a string. if(is_array($metaarray)){ $metaarray[‘mynewfield’] = ‘Some text i need to … Read more

How to show particular category all post in custom single file

Using The Loop with the required arguments should list all the posts. An Example: $temp = $wp_query; <?php $type=”post_type”; $args = array ( ‘post_type’ => $type, ‘post_status’ => ‘publish’, ‘paged’ => $paged, ‘posts_per_page’ => 20, ‘ignore_sticky_posts’=> 1 ); $temp = $wp_query; // assign ordinal query to temp variable for later use $wp_query = null; $alt … Read more

How to stop wordpress from mangling HTML in a metabox textarea

I’v re-worked your code. I’ll try to explain some of the changes after the code block add_action(“admin_menu”, “tf_book_deets_create”); function tf_book_deets_create(){ add_meta_box(‘tf_book_details’, ‘Book Details’, ‘tf_book_details’, ‘books’); } function tf_book_details () { global $post; $tf_book_media = get_post_meta($post->ID, “tf_book_media”, true); $tf_book_review = get_post_meta($post->ID, “tf_book_review”, true); ?> <div class=”admin_meta”> <ul> <li><label>Reviews:</label><textarea rows=”5″ cols=”70″ name=”tf_book_review”><?php echo esc_textarea($tf_book_review); ?></textarea></li> <li><label>Media:</label><textarea rows=”5″ … Read more

Create separate template for shared custom taxonomy with shared terms

See, It’s quite difficult to have path like site/books/product_category/horror/ site/movies/product_category/horror/ As wordpress functionality will conflict between custom_post_type & their taxonomy if try to keep url like you mentioned. I suggest you consider the I mentioned below as a solution of your problem. site/product_category/horror/?post_type=books site/product_category/horror/?post_type=movies Now to keep template as per shared terms, Create two templates … Read more