How to query images from a post to use in a slider

Your second arg “p = 107” isn’t valid. What you could try is the get_attached_media() function. And do something like this: $media = get_attached_media(‘image’, 2360); foreach ($media as $m) { echo ‘<li>’; echo wp_get_attachment_image( $m->ID, ‘home-slider’ ); echo ‘</li>’; }

Issue in If else condition [closed]

Try to replace the following: <?php $sectyp = array( ‘meta_query’ => array( array( ‘key’ => ‘section_type’, // selecting the section type “Normal” or “Parallax” ‘value’ => ‘Parallax’ ), ), ); ?> with <?php $sectyp = get_post_meta(get_the_ID(), ‘section_type’, true); ?> and replace <?php if($sectyp) { ?> with <?php if($sectyp == “Parallax”) { ?>

Use Tags to Query Associated Multiple Posts and Get The Average Of Custom Field Values

If you use those custom fields only for the company tagged posts, then it’s sufficient to retrieve the custom fields without worrying about posts and tags: $tags = array(‘Professional Rating’, ‘Efficiency Rating’, ‘Referral Rating’); foreach ($tags as $tag) { $result = $wpdb->get_col( “SELECT meta_value FROM wp_postmeta WHERE meta_key = ‘$tag'” ); $avg = empty($result) ? … Read more

How to pass taxonomy terms to WP_Query along with $args?

You can do like following $thiscat = $wp_query->get_queried_object();//put this code $args = array( ‘post_type’ => ‘sports’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘sports_category’, ‘field’ => ‘slug’, ‘terms’ => $thiscat->slug // Pass this to slug ), ), ); $myquery = new WP_Query($args); then you can able to fetch post titles tagged under football and basketball separately … Read more