Extra profile field as select box?

Place the following code in your functions.php <?php add_action( ‘show_user_profile’, ‘show_extra_profile_fields’ ); add_action( ‘edit_user_profile’, ‘show_extra_profile_fields’ ); function show_extra_profile_fields( $user ) { ?> <h3>Extra profile information</h3> <table class=”form-table”> <tr> <th><label for=”gender”>Gender</label></th> <td> <select name=”gender” id=”gender” > <option value=”Male” <?php selected( ‘Male’, get_the_author_meta( ‘gender’, $user->ID ) ); ?>>Male</option> <option value=”Female” <?php selected( ‘Female’, get_the_author_meta( ‘gender’, $user->ID ) … Read more

Filter post listing by meta value which is a date

Add a query variable to store the month So first of all it’ll be necessary to create a custom query variable – this will store the month we’re after (in 2012/6) format. I’ll call it custom_month, but its best practise to prefix it to avoid clashes with other plug-ins: add_filter(‘query_vars’, ‘wpse57344_register_query_vars’ ); function wpse57344_register_query_vars( $qvars … Read more

Apply the_content filter to a custom field with multiple values

All you need to do use apply_filters. foreach ($video as $vid) { echo ‘<li>’.apply_filters(‘the_content’,$vid).'</li>’; } It may be more efficient to concatenate a string and then run the filter on the whole thing. $lis=””; foreach ($video as $vid) { $lis .= ‘<li>’.$vid.'</li>’; } echo apply_filters(‘the_content’,$lis); I haven’t benchmarked the one versus the other but given … Read more

How to add add_meta_box to specific Page Template?

If your custom page template filename is foobar.php, you can use get_post_meta(): global $post; if ( ‘foobar.php’ == get_post_meta( $post->ID, ‘_wp_page_template’, true ) ) { // The current page has the foobar template assigned // do something } Personally, I like calling this inside my add_meta_boxes_page callback, and wrapping it around the add_meta_box() call itself. … Read more

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