how to display count of total posts and for every category and having possibility to filter between dates and user

Question

Hello i use simple plugin that count numbers of posts for every category and total but i was stuck in how to display count of posts between to dates and with authors.

<div class="wrap posts-and-users-stats">

    <nav class="nav-tab-wrapper">
        <?php echo "<h2> Nombres des articles </h2>" ?>

    </nav>

    <section>
        <?php
    $categories = get_categories( array(
    'orderby' => 'name',
    'order'   => 'ASC'
) );
 
        <table id="table-<?php echo esc_attr($taxonomy); ?>" class="wp-list-table widefat">
                        <tbody>
                <?php foreach ($categories as $category) { ?>
                    <tr>
                        <td><?php echo esc_html($category->name ); ?></td>
                        <td class="number"><?php echo esc_html($category->count); ?></td>
                    <?php } ?>
                    </tr>
            </tbody>
        
        </table>
    </section>


</div>

this the code i used for filter

<form method="post">
            From : <input type="date" name="from">
            To : <input type="date" name="to">
            User :<?php wp_dropdown_users($args); ?>
            Catégories :<?php wp_dropdown_categories($args); ?>
            <input type="submit" name="submitbtn">
        </form>
    <?php
    
    $from = $_POST['from'];
    $to = $_POST['to'];
    $user = $_POST['user'];
    $category = $_POST['categories'];
    print "From" . $from . "n";
    print "To" . $to . "n";
    print "User" . $user . "n";
0
Hassani Mohamed 2 months 0 Answers 13 views 0

Leave an answer