Last active
July 10, 2017 20:20
-
-
Save macdawne/7a2ed47c6927bf49d2591e9313e091dc to your computer and use it in GitHub Desktop.
Show-Count-Post-Wp.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$allpoststype = new WP_Query(array( 'post_type')); | |
if ($allpoststype->have_posts()) : | |
$count_posts = wp_count_posts()->publish; | |
if ( $count_posts == "1" ) : | |
echo "<center> | |
<button type='button' class='btn btn-success'>Notification | |
<span class='badge'>01</span></button> </center>"; ?> | |
<?php else : | |
echo "<center> | |
<button type='button' class='btn btn-danger'>Notification | |
<span class='badge'> $count_posts </span></button> </center>"; | |
endif;?> | |
<?php else : ?> | |
<center> | |
<button type='button' class='btn btn-info'>Notification | |
<span class='badge'>00</span></button> </center> | |
<?php endif;?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment