WP_query : meta_key with custom rule for specific value

A meta_query is an array of arrays. Look at the examples in the the Codex. $args = array( ‘post_type’ => ‘my_custom_post_type’, ‘meta_key’ => ‘age’, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘ASC’, ‘meta_query’ => array( array( ‘key’ => ‘age’, ‘value’ => array(3, 4), ‘compare’ => ‘IN’, ) ) ); $query = new WP_Query($args); What you have is … Read more

Using posts and postmeta table to store custom Address Book Plugin data

Using posts & postmeta: There is nothing wrong in using posts and postmeta table for custom database requirements. In WordPress, although posts & postmeta table was originally there to create blog posts, later it evolved to cover many different sorts of database requirements. Using Custom Post Types, Post Meta & Custom Taxonomies, you can satisfy … Read more

Add input field to ‘Pages > Edit Page’ through functions.php

functions.php // Add custom Slider ID field to ‘Edit Page’ add_action( ‘add_meta_boxes’, ‘cd_meta_box_add’ ); function cd_meta_box_add() { add_meta_box( ‘my-meta-box-id’, ‘Slider’, ‘cd_meta_box_cb’, ‘page’, ‘normal’, ‘high’ ); } function cd_meta_box_cb( $post ) { $values = get_post_custom( $post->ID ); $text = isset( $values[‘my_meta_box_text’] ) ? esc_attr( $values[‘my_meta_box_text’][0] ) : ”; wp_nonce_field( ‘my_meta_box_nonce’, ‘meta_box_nonce’ ); ?> <p> <label for=”my_meta_box_text”>Add … Read more

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