Adding class to last list item? Not WP generated

I can only see achieving this by first building an array, then looping over it – I can’t find anything in APC’s docs about checking if it’s the last iteration of the_repeater_field: $images = array(); while ( the_repeater_field( ‘homepage_service’ ) ) $images[] = get_sub_field( ‘service_image’ ); if ( $images ) { $image_last = array_pop( $images … Read more

Website loading slowly – Advanced Custom Fields images

I have managed to work it out – the function was leading to a lot of queries, so I rewrote it as follows: $housePhotos = get_post_custom_values(‘house_photos’); $housePhotos = explode(‘;’,$housePhotos[0]); preg_match_all(‘`”([^”]*)”`’, $housePhotos[1], $results); $imageURL = wp_get_attachment_image_src( $results[1][0], ‘house_search’ ); if (!empty($results[1][0])) { echo ‘<img src=”‘ . $imageURL[0] .'” alt=”” />’; }

Querying posts by latitude and longitude to build a Google Maps with several markers

To connect your meta fields with the “Geo Data Store”-Plugin, you simply take the name of the meta key/field and map it with the filter to the plugin. add_filter( ‘sc_geodatastore_meta_keys’, ‘wpse82502_lat_lng_metakey_mapping’ ); function wpse82502_lat_lng_metakey_mapping( $keys ) { $keys[] = “your_meta_key_field_name”; return $keys; } To get the data from PHP to JS, simply use wp_localize_script().

How can i count the images that are atacht to NextGEN Gallery

Assuming you actually have something in the $gallery object (hint: confirm that by print_r($gallery) in your template), then your code should work. Perhaps step back and leave the database stuff to NextGEN, just count the image IDs: global $nggdb; $poze = get_field(‘poze’); if ($poze && count($poze)) { $galleryID = $poze[0][‘ngg_id’]; $imageIDs = $nggdb->get_ids_from_gallery($galleryID); $count = … Read more

How to create a multidimensional array with multiple loops

I don’t think this is a restrict WordPress question, but you might try $args = array( ‘posts_per_page’ => ‘-1’, ‘post_type’ => ‘work’, ‘orderby’ => ‘ID’, ‘order’ => ‘DESC’, ); $data = array(‘work’ => array()); $loop = new WP_Query($args); if( $loop->have_posts() ): while( $loop->have_posts() ): $loop->the_post(); $id = $loop->post->ID; $attachments=array(); if(get_field(‘work’)): while(has_sub_field(‘work’)): $attachment_id = get_sub_field(‘image’); $caption … Read more

Post loop count is not in order

a) Try to initialize the $count variable before your loop: $counts=0; $loop = new WP_Query( array( ‘post_type’ => ‘focus-areas’, ‘posts_per_page’ => -1 ) ); while ( $loop->have_posts() ) : $loop->the_post(); $counts++; echo $counts; echo ” – “; endwhile; b) or use the current_post method (starts at 0) of WP_Query: $loop = new WP_Query( array( ‘post_type’ … Read more

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