Shortcode with loop stacks output

Ok…So, I was able to find an example that helped: function faq() { $output=””; $query = new WP_Query( ‘post_type=faqs’ ); if ( $query -> have_posts() ) : while ( $query -> have_posts() ) : $query -> the_post(); $output .= ‘<h3>’.get_the_title().'</h3>’; $output .= ‘<p>’.get_the_content().'</p>’; endwhile; endif; wp_reset_postdata(); return $output; } add_shortcode( ‘faqs’, ‘faq’ ); This puts … Read more

get the value for ALT is we check to see if an actual ALT value is set, if not we use the caption and if no caption is set we use the title

Not sure if this’ll work for you because I don’t know if $attachment_ID in the function is returning anything at all… …but assuming it is: function custom_pic_alt( $attachment_ID ) { //var_dump( $attachment_ID ); //uncomment this and see if it even returns anything. $thumb_alt = get_post_meta( $attachment_ID, ‘_wp_attachment_image_alt’, true ); $thumb_caption = wp_get_attachment_caption( $attachment_ID ); $thumb_title … Read more

Duplicated tag in loop

Seems like one of your ACF fields contain a <a> tag in them. In HTML you cannot have and <a> tag inside another <a> tag. Check the ACF fields the_field(‘feature_item_title’) and the_field(‘hero_subtitle’), check their content, most likely you will find a <a> tag in one of them, remove it and your html will be structured … Read more

wp_get_attachment_url not fetching URL?

then check like that: $thumb_id = get_woocommerce_term_meta( $subcategory->term_id, ‘thumbnail_id’, true ); $term_img = wp_get_attachment_url( $thumb_id ); and check like this $meta = get_term_meta( $subcategory->term_id ); var_dump($meta); $thumb_id = $meta[‘thumbnail_id’][0]; $term_img = wp_get_attachment_url( $thumb_id ); and you also get like this $thumbnail_id = get_term_meta( $subcategory->term_id, ‘thumbnail_id’, true ); $image = wp_get_attachment_url( $thumbnail_id );