How to make a metabox that contains link categories?

Found the last bit. It was just a syntax error: <?php selected( $selected, “.$term_id”. ); ?> Should be… <?php selected( $selected, $term_id ); ?> Entire Function: function tf_book_deets_create(){ add_meta_box(‘tf_book_purchase’, ‘Book Purchase Links’, ‘tf_book_purchase’, ‘books’,’side’,’default’); } function tf_book_purchase (){ global $post; $custom = get_post_custom($post->ID); $link = $custom[“link”][0]; $selected = isset( $custom[‘link’] ) ? esc_attr( $custom[‘link’][0] ) … Read more

Checkbox in post not saving value

Change, echo ‘<input type=”checkbox” id=”movie_abc” name=”movie_abc” value=”true” />’; to… echo ‘<input type=”checkbox” id=”movie_abc” name=”movie_abc” value=”1″‘ . checked( $mydata , 1 ) . ‘/>’; …and let us know how you go. Update Try the following, echo ‘<input type=”checkbox” id=”movie_abc” name=”movie_abc” value=”1″‘, $mydata ? ‘ checked=”checked”‘ : ”, ‘/>’; Update 2 This is a duplicate question; I … Read more

Exclude posts based on an array

You’re looking for post__in & post__not_in parameters http://codex.wordpress.org/Class_Reference/WP_Query#Post_.26_Page_Parameters Both of them are an array of ID’s for the post’s to include or exclude in the results BTW in your code, you had a semicolon just after your foreach

Metabox does not show in custom post type

The custom post type is being register as name, not snippet as is being called in add_meta_boxes action. This is because a PHP var is passed inside single quotes and it is not being interpreted. Change this: register_post_type(‘$name’, $args); To: register_post_type($name, $args); This also work: register_post_type(“$name”, $args); But never pass PHP variables inside single quotes … Read more

Help with if statement inside while loop

You’re setting $id = $post->ID; outside of the loop for agent_type posts, it’ll never match. Anyway, if you’re not doing anything with the agent_type posts that don’t match, just query for the one post you want by its ID: $list_agent = get_post_meta( $post->ID,’ec_agents’,true ); $args = array( ‘post_type’ => ‘agent_type’, ‘p’ => $list_agent ); $agent_query … Read more