add_filter( 'wpcf7_form_elements', 'wpcf7_remove_span_wrapper' );
function wpcf7_remove_span_wrapper( $content ) {
$str_pos = strpos( $content, 'target-class' );
if ( $str_pos !== false ) {
$content = preg_replace( '/<(span).*?class="\s*(?:.*\s)?wpcf7-form-control-wrap(?:\s[^"]+)?\s*"[^\>]*>(.*)<\/\1>/i', '\2', $content );
$content = str_replace( '<br />', '', $content );
}
return $content;
}
'order' => 'DESC',
'orderby' => 'meta_value_num',
'meta_query' => [
[
'relation' => 'OR',
array(
'key' => '_thumbnail_id',
'compare' => 'NOT EXISTS'
],
[
'key' => '_thumbnail_id',
'compare' => '!NOT EXISTS'
]
]
$out = '';
$html = <<<HTML
<tr class="woocommerce-product-attributes-item woocommerce-product-attributes-item--%s">
<th class="woocommerce-product-attributes-item__label">%s</th>
<td class="woocommerce-product-attributes-item__value">%s</td>
</tr>
HTML;
$i = 1;
foreach ( $product_attributes as $attribute ):
$attribute_data = $attribute->get_data();
if ( $i !== 3 ) {
$out .= sprintf( $html, esc_attr( $attribute_data['name'] ), wc_attribute_label( $attribute_data['name'], $product->get_attribute( $attribute_data['name'] ) ) );
} else {
printf( $html, esc_attr( $attribute_data['name'] ), wc_attribute_label( $attribute_data['name'], $product->get_attribute( $attribute_data['name'] ) ) );
}
$i ++;
endforeach;
echo $out;
if ( have_posts() ) : $n = 1;
while ( have_posts() ) : the_post();
$template = 1 === $n ? 'big' : 'small';
if ( 1 === $n ) {
echo '<div class="row"><div class="col-lg-6">';
}
if ( 2 === $n ) {
echo '<div class="col-lg-6">';
}
get_template_part( 'templates/post', $template );
if ( 3 === $n ) {
echo '</div>'; //<div class="col-lg-6"> - close $n = 2
}
if ( 1 === $n ) {
echo '</div>'; //<div class="col-lg-6"> - close $n = 1
}
if ( 3 === $n ) {
echo '</div>'; //<div class="row"> - close $n = 1
}
$n ++;
endwhile;
else :
endif;
WC()->cart->add_to_cart( $product_id );
$product_cart_id = WC()->cart->generate_cart_id( $product_id );
$in_cart = WC()->cart->find_product_in_cart( $product_cart_id );