<?php // демо стили
wp_enqueue_style('dashicons'); ?>
<style>
.my-cat li {
float: left;
width: 31%;
text-align: center;
border: 1px solid;
margin: 1%;
list-style: none;
padding: 10px;
}
.my-cat h3 {
border-bottom: 1px solid;
}
.my-cat span {
width: 50%;
float: left;
}
</style>
<?php // сам код вывода
$cat_ids= get_all_category_ids();
foreach ($cat_ids as $cat_id) {
$args = array(
'numberposts' => 3,
'cat' => $cat_id,
'post_status' => 'publish'
);
echo "<h2>" . get_cat_name( $cat_id ) . "</h2>";
echo "<ul class='my-cat cat-" . $cat_id . "'>";
$posts = wp_get_recent_posts($args);
foreach( $posts as $post ){ ?>
<li class="my-post post-<?php echo $post['ID'] ?>">
<h3><a href="<?php echo get_permalink($post['ID']) ?>"><?php echo $post['post_title'] ?></a></h3>
<p><?php echo wp_trim_words($post['post_content'],22) ?></p>
<span class="dashicons dashicons-format-chat"><?php echo $post['comment_count']; ?></span>
<span class="dashicons dashicons-visibility">1777</span>
</li>
<?php }
echo "</ul>";
}
if(android) {
$blablabla = 'android';
} elseif (htc){
$blablabla = 'htc';
} else {
$blablabla = '';
}
get_header($blablabla);
get_template_part( 'single_template', $blablabla );
get_sidebar($blablabla);
get_footer($blablabla);
add_filter( 'woocommerce_checkout_fields' , 'remove_checkout_fields' );
function remove_checkout_fields( $fields ) {
unset($fields['billing']['billing_first_name']);
unset($fields['billing']['billing_last_name']);
unset($fields['billing']['billing_company']);
unset($fields['billing']['billing_address_1']);
unset($fields['billing']['billing_address_2']);
unset($fields['billing']['billing_city']);
unset($fields['billing']['billing_postcode']);
unset($fields['billing']['billing_country']);
unset($fields['billing']['billing_state']);
unset($fields['billing']['billing_phone']);
unset($fields['order']['order_comments']);
unset($fields['billing']['billing_email']);
unset($fields['account']['account_username']);
unset($fields['account']['account_password']);
unset($fields['account']['account_password-2']);
return $fields;
}