Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $agent_name = $product->get_attribute( 'pa_imya-agenta' );
- $posts = get_posts(array(
- 'numberposts' => -1,
- 'post_type' => 'comands',
- 'meta_query' => array(
- 'relation' => 'AND',
- array(
- 'key' => 'metka',
- 'value' => array($agent_name),
- 'compare' => 'IN',
- ),
- ),
- ));
- $products = new WP_Query( array(
- 'post_type' => array('product'),
- 'post_status' => 'publish',
- 'posts_per_page' => -1,
- 'tax_query' => array( array(
- 'taxonomy' => 'pa_imya-agenta',
- 'field' => 'name',
- 'terms' => array($agent_name),
- 'operator' => 'IN',
- ) )
- ) );
- $slug = $posts[0]->post_name;
- $agent_page_link = "https://praid-pro.ru/comands/" . $slug . "/";
- $objects_count = count($products->posts);
- $objects_count_string = num_decline($objects_count, array("объект", "объекта", "объектов"));
- $vars = [
- $agent_page_link,
- $objects_count_string
- ];
- $result = sprintf('<div class="label_spec">Специалист по недвижимости</div><a href="%s" class="object_spec">Объекты специалиста</a></div><a data-w-id="c5da5e96-65e0-9450-40ff-4c3f22b7758c" href="#" class="btn_call_spec w-button">задать вопрос</a></div>', ...$vars);
- echo $result;
- ?>
Add Comment
Please, Sign In to add comment