Tag Info

New answers tagged

0

wp_get_attachment_image_src returns an array with 3 elements; the image URL, the width, and the height. You need to echo the first index of the result. In fact, you can make your code a little leaner by using a foreach loop: foreach ( $images as $i => $image ) { $src = wp_get_attachment_image_src( $image->ID, 'full' ); echo '<img ...


1

if you want to show only 2, put it as a value, like so: 'posts_per_page' => 2 For the newest posts, you need to change the sort using the order and orderby params: 'orderby' => 'date', 'order' => 'ASC' Details about orderby params here: http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters Also, you should avoid ...


0

so i removed the pagination by removing this from lower <?php get_template_part('inc/pagination'); ?> <?php else: ?> <h3><?php echo ot_get_option('no_artists'); ?></h3> then changed $ppp_artists = ot_get_option('ppp_artists'); to $ppp_artists = 2; which changed the number of posts to 2 however I need ...


0

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 ) { ...


0

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();


0

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) { $arr = ...


0

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.



Top 50 recent answers are included