Create A Metabox For A Custom Field

This will create a metabox for you to enter a video code. //Creating a MetaBox for Posts to enter Video Code. add_action(‘add_meta_boxes’,’video_meta_box’); function video_meta_box(){ add_meta_box(‘video_box_id’, ‘Enter Video ‘ , ‘video_box_cb’,’post’,’normal’,’default’); } function video_box_cb($post){ $value = get_post_meta($post->ID,’video_box’,true); echo ‘<textarea rows=”4″ cols=”50″ id=”video_box”, name=”video_box”>’; echo $value; echo ‘</textarea>’; } add_action(‘save_post’,’save_video_box’); function save_video_box($post_id){ $box_data = $_POST[‘video_box’]; update_post_meta($post_id,’video_box’,$box_data); } … Read more

Get post info inside modal window?

It would appear your use of Thickbox is the culprit. When opening a thickbox via the anchor, the thickbox parameters must always be last, else the other parameters will be removed, e.g. your movies Post ID http://devll.wordpress.com/2009/10/01/jquery-iframe-thickbox-removes-parameter/ Firstly, your use of queries is incorrect, what’s more you never tell your query which post to look … Read more

Using custom fields in a filter hook

Try get_queried_object() to reference the WP_Post that created the page. if you’re on a single post, it will return the post object if you’re on a page, it will return the page object if you’re on an archive page, it will return the post type object if you’re on a category archive, it will return … Read more

Display two post types ordered by two custom fields

My old code was wrong, this is a good one, as I think: function add_custom_post_type_to_query( $query ) { if ( $query->is_home() && $query->is_main_query() ) { $query->set( ‘post_type’, array( ‘post’, ‘facebook_events’, ‘event’ ) ); $query->set( ‘meta_query’, array( ‘relation’ => ‘OR’, array( ‘key’ => ‘event_start_date’, //this is from facebook_events post type ‘value’ => date_i18n(“Y-m-d”), ‘compare’ => ‘>=’, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)