function get_type_furniture_tabs( $attr ) {
// задаем нужные нам критерии выборки данных из БД
$args = array(
'post_type' => 'furniture',
'posts_per_page' => 10,
'orderby' => 'menu_order'
);
$query_fur = new WP_Query( $args );
if ( $query_fur->have_posts() ) {
while ( $query_fur->have_posts() ) {
$query_fur->the_post();
$furniture_html .= '<ul class="furniture_col"><li class="get_title">' . get_the_title() . '</li>';
$furniture_html .= '<ul>';
$rows = get_field('link');
if($rows){
$furniture_html .= '<ul class="links-col">';
$num_i = 0;
foreach($rows as $row){
$num_i++;
$furniture_html .= '<li><a href="'. $row['link_url'] .'">'. $row['link_text'] .'</a></li>';
if( ($num_i % 12) == 0 ){ $furniture_html .= '</ul><ul class="links-col">'; }
}
$furniture_html .= '</ul>';
}
$furniture_html .= '</ul></ul>';
}
} else {
// Постов не найдено
}
/* Возвращаем оригинальные данные поста. Сбрасываем $post. */
wp_reset_postdata();
return $furniture_html;
}
add_shortcode( 'get_furniture_li', 'get_type_furniture_tabs' );