Shortcode to display nummer of CPT posts

PHOTO EMBED

Fri May 20 2022 11:17:42 GMT+0000 (UTC)

Saved by @MirkoEchghiG #php

<?php

function post_count() {
    $post_type = 'unternehmer';
    $total = wp_count_posts($post_type)->publish;
    return $total;
}
add_shortcode(‘unternehmer_anzahl’,’post_count’);
content_copyCOPY