1. Home
  2. Test
[divi_php] $args = array( 'post_type' => 'awlq_ambassador', 'nopaging' => true, 'meta_key' => 'awlq_ambassador_patron', 'orderby' => array( 'meta_value' => 'DESC', 'title' => 'ASC' ), ); $theShort = '[et_pb_section custom_padding="0px|0px|0px|0px" custom_css_main_element="z-index:0;"]'; // the query $the_query = new WP_Query( $args ); if ( $the_query->have_posts() ) : // the loop while ( $the_query->have_posts() ) : $the_query->the_post(); $post_id = get_the_ID(); $AmbassadorLink = get_permalink($post_id); $AmbassadorTitle = get_the_title($post_id); $thumbID = get_post_thumbnail_id($post_id); $AmbassadorImage = wp_get_attachment_image_src($thumbID, 'large'); $AmbassadorExcerpt = get_the_excerpt($post_id); $theShort .= '[et_pb_row custom_padding="0px|||" make_equal="on" custom_css_main_element="width:100% !important"]'; if ($the_query->current_post % 2 == 0) { $theShort.= '[et_pb_column custom_padding="0px|0px|0px|0px" type="1_3"]'; if($AmbassadorImage){ $theShort .= '[et_pb_image src="'.$AmbassadorImage[0].'" animation="fade" align="center"][/et_pb_image]'; } else { $theShort .= '[et_pb_image src="'.get_stylesheet_directory_uri().'/images/placeholder-animal.jpg" animation="fade" align="center"][/et_pb_image]'; } $theShort .='[/et_pb_column][et_pb_column custom_padding="0px|0px|0px|0px" type="2_3"]'; $theShort .= '[et_pb_text text_orientation="center"]

'.$AmbassadorTitle.'

[/et_pb_text]'; $theShort .= '[et_pb_text]'.$AmbassadorExcerpt.'[/et_pb_text]'; $theShort .= '[et_pb_button button_url="'.$AmbassadorLink.'" button_text="Learn More" button_alignment="center"][/et_pb_button]'; $theShort .= '[/et_pb_column][/et_pb_row]'; } else { $theShort .= '[et_pb_column custom_padding="0px|0px|0px|0px" type="2_3"]'; $theShort .= '[et_pb_text text_orientation="center"]

'.$AmbassadorTitle.'

[/et_pb_text]'; $theShort .= '[et_pb_text]'.$AmbassadorExcerpt.'[/et_pb_text]'; $theShort .= '[et_pb_button button_url="'.$AmbassadorLink.'" button_text="Learn More" button_alignment="center"][/et_pb_button]'; $theShort .= '[/et_pb_column]'; $theShort .= '[et_pb_column custom_padding="0px|0px|0px|0px" type="1_3"]'; if($AmbassadorImage){ $theShort .= '[et_pb_image src="'.$AmbassadorImage[0].'" animation="fade" align="center"][/et_pb_image]'; } else { $theShort .= '[et_pb_image src="'.get_stylesheet_directory_uri().'/images/placeholder-animal.jpg" animation="fade" align="center"][/et_pb_image]'; } $theShort .='[/et_pb_column][/et_pb_row]'; } $theShort .= '[et_pb_row custom_padding="0px|||" make_equal="on" custom_css_main_element="width:100% !important"][et_pb_column custom_padding="0px|0px|0px|0px" type="4_4"][et_pb_divider color="#000" show_divider="on" height="3" divider_style="solid" divider_position="top" hide_on_mobile="off"][/et_pb_divider][/et_pb_column][/et_pb_row]'; $i++; endwhile; // end of the loop wp_reset_postdata(); $theShort .= '[/et_pb_section]'; echo do_shortcode($theShort); else :[/divi_php]

[divi_php] _e( 'Sorry, no posts matched your criteria.' ); [/divi_php]

[divi_php] endif; [/divi_php]