How to include post count in this “get_tags” snippet

where exactly? example below is for the count getting shown in brackets after the tag name, outside the link: <?php $tags = get_tags(); if ($tags) { foreach ($tags as $tag) { echo ‘<li><a href=”‘ . get_tag_link( $tag->term_id ) . ‘” title=”‘ . sprintf( __( “View all posts in %s” ), $tag->name ) . ‘” ‘ … Read more

Accessing array elements (get_pages)

The return set of $children is an associative array. So you can get the IDs with: $children = get_children( $args ); foreach ($children as $k => $v) { echo $k; // do stuff with $v }

Accessing value from associative array

You’re doing one to many loops. What you want to be doing is this: $args = array( ‘child_of’ => $CurrentPage ); $children = get_pages( $args ); foreach ($children as $key => $value) { echo $key[‘post_title’]; }; Or you could also: $args = array( ‘child_of’ => $CurrentPage ); $children = get_pages( $args ); foreach ($children as … Read more

Echo custom field value in shortcode function

Try this code, I’ve removed query_posts and used get_posts instead because I’m not sure if query_posts will work in a shortcode and using get_posts is safer. function featured() { $posts = get_posts(array(‘post_type’ => ‘property’, ‘posts_per_page’ => 2)); if(isset($posts) && !empty($posts)) { foreach($posts as $post) { echo “<div class=\”singlefeatured group\”>”; //I wasn’t sure what you wanted … Read more

post custom values

Use var_dump($site[0]) to see the structure of the array. And once you know that, then you can properly reference an item in that array. (You could also do var_dump($site) to get a full picture of what’s going on.)

WordPress loop: Display if posts exist

You can use the has_tag function in a conditional statement to achieve what you want. Take a look at the codex page here: Function Reference/has tag. This isn’t 100% tailored to your specific question, but you should see how it’s working and adjust for your specific task: <?php if( has_tag() ) { ?> <?php query_posts( … Read more

Creating Custom Query

Try following codes: $country_search_array = array(); while($row = mysql_fetch_array($regionresult)){ $country_search_array[] = $row[‘country’]; // Your country field name } $country_search = “‘”.implode(“‘,”, $country_search_array).”‘”; $args = array( ‘posts_per_page’ => -1, ‘meta_query’ => array( array( ‘key’ => ‘Country’, ‘value’ => $country_search, ‘compare’ => ‘IN’ ) ) ); $query = new WP_Query( $args );

WordPress Query Returning Every Post

Thanks for all of the help! It tured out to be a combination of issues: Instead of imploding the $country_search_array, it needs to be added as is to the query. Since it’s an array, we can’t use the ‘=’ for the compare value. It needs to be ‘IN’ I couldn’t have figured it out without … Read more

Showing all post from all post type in admin backstage

You can use a $wpdb->get_results for this. I am not an mySQL expert so I will give you the pseudo code instead global $wpdb; $data = $wpdb->get_results( SELECT posts.ID ID, posts.post_title title, posts.post_author author, postmeta.isbn isbn FROM $wpdb->posts posts JOIN $wpdb->postmeta postmeta ON posts.ID = postmeta.post_id WHERE posts.post_type=”post_type_1″ OR ‘post_type_2’ OR ‘post_type_3’ GROUP BY posts.ID … Read more

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