How to use array in function to get only value I want

There’s wp_list_pluck() to get certain fields out of arrays or objects: $object = new StdClass(); $object->foo = ‘Hi!’; $object->bar=”Yo!”; $array[‘foo’] = ‘Hi!’; $array[‘bar’] = ‘Yo!’; $result_obj = wp_list_pluck( $object, ‘foo’ ); var_dump( $result_obj ); // Result: string (3) Hi! $result_array = wp_list_pluck( $array, ‘bar’ ); var_dump( $result_array ); // Result: string (3) Yo!

List custom field values ​​in alphabetical order without repetition

You could do a custom SQL query: global $wpdb; $query = “SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = ‘director’ ORDER BY meta_value;”; $directors = $wpdb->get_results( $query ); foreach( $directors as $director ) : echo $director->meta_value; endforeach; one thing to note here though is that since you’re not querying the associated posts, you could get … Read more

How to get a value from comment meta

Looking at the Codex entry for get_comment_meta(), it appears that when the $single argument is set to TRUE (as you have done), the function returns a string. Try throwing an echo() into the works: <?php echo get_comment_meta( $comment->comment_ID, ‘country’, true ); ?>

Does meta_value (array) work with ‘orderby’?

Researching more, I got it to work with the following code $post = array( ‘posts_per_page’ => 10, ‘post_type’ => ‘post’, ‘tax_query’ => array( ‘taxonomy’ => ‘category’, ‘field’ => ‘slug’, ‘terms’ => ‘category-1’ ), ‘meta_query’ => array( array( ‘key’ => ‘custom-key’, ‘value’ => array(1,100), ‘compare’ => ‘BETWEEN’, ‘type’ => ‘NUMERIC’ ) ), ‘meta_key’ => ‘custom-key’, ‘orderby’ … Read more

Add estimated value for a post according to the number of words

Here’s an idea for a starting point, by looking how the word counting is done in the /wp-admin/js/post.js file: /** * Testing word price calculations */ add_action( ‘after_wp_tiny_mce’, function() { ?><script> ( function( $ ) { $( function() { // Init var $content = $( ‘#content’ ), $count = $( ‘#wp-word-count’ ).find( ‘.word-count’ ), total_price … Read more

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