How to get several fields from wp_query?
Try to set 3-rd parametr for wp_list_pluck function, as i see if it’s not set then there’s happaning an unnessesery, for you, loop. Try to set it to true or some, not existing in Object, key. Hope it helps.
Try to set 3-rd parametr for wp_list_pluck function, as i see if it’s not set then there’s happaning an unnessesery, for you, loop. Try to set it to true or some, not existing in Object, key. Hope it helps.
The custom fields I am using are from the plugin ACF (Advanced Custom Fields). I finally looked at the ACF website, which I should have done originally, and found the function get_field can specify a post so here is the working code: $posts = get_posts(array( ‘numberposts’ => -1, ‘post_type’ => ‘post’,)); foreach($posts as $post) { … Read more
You can access the current post ID within the loop via get_the_ID() while ( $secondary_loop->have_posts() ) : $secondary_loop->the_post(); rating( get_the_ID() ); endwhile; wp_reset_postdata();
Try building a master $posttags array like so: <?php $post_tags = array(); $the_query = new WP_Query( ‘posts_per_page=50&cat=89’ ); if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); $posttags = get_the_tags(); foreach( $posttags as $posttag ) { $post_tags[$posttag->slug] = $posttag->name; } endwhile; endif; ?> <ul class=”dropdown filter option-set clearfix” data-filter-group=”tags”> <li><a href=”#filter-tags-all” data-filter-value=”.item” class=”selected”>All … Read more
wp_query – Modify $query to include duplicate content
You could achieve this with get_terms() and ‘name__like’ => ‘Author:’ argument. See linked documentation. From architecture perspective, however, you probably shouldn’t be (ab)using tags for this. It would make sense to split your authors into custom taxonomy. It would be more clear semantically, as well as easier to deal with in interface and code.
Just make sure it’s definitely an array before you try to merge it: function minevalg_hent_innstillinger() { $defaults = array(); // define this somewhere; reference it here if ( is_array( $options = get_option( ‘minevalg’ ) ) ) $options = array_merge( $defaults, $options ); else $options = $defaults; return $options; }
When using an options array the Settings API isn’t creating the database record
Auto remove empty values in array
Ok i was a bit headblocked; with the following snippet i was able to get things working as expected: $media = abc_attachments( $post->ID ); $arrayofids = array(); foreach( $media as $key ) { array_push($arrayofids, $key->ID); } preprint($arrayofids); Which lead to the following output: Array ( [0] => 1072 [1] => 1067 )