• Resolved sefr

    (@sefr)


    Hello

    How I can show latest submissions in dashboard block? (e.g. last 10 submissions)

    —–
    add_action(‘wp_dashboard_setup’, ‘najmail_wp_dashboard_setup’);

    function najmail_wp_dashboard_test() {
    echo ‘-‘;
    }

    function najmail_wp_dashboard_setup() {
    wp_add_dashboard_widget( ‘najmail_wp_dashboard_test’, __( ‘Latest e-mails’ ), ‘najmail_wp_dashboard_test’ );
    }
    ——

    Thanks for your time!

Viewing 1 replies (of 1 total)
  • Plugin Author jasongreen

    (@jasongreen)

    Hi sefr

    Thats a great idea.

    You can get the latest submissions by doing a simple wp query. Heres a quick example:

    <ul>
    <?php
    $args = array( 'post_type' => 'wpcf7s', posts_per_page' => 10, 'post_status' => 'any' );
    $submissions = get_posts( $args );
    foreach ( $submissions as $post ) : setup_postdata( $post );
      $contact_form_id = get_post_meta(get_the_ID(), 'form_id', true); ?>
      ...
    <?php endforeach; 
    wp_reset_postdata(); ?>
    </ul>
Viewing 1 replies (of 1 total)
  • The topic ‘Latest Submissions in Dashboard’ is closed to new replies.