Plugin Directory

Changeset 2586110

Timestamp:
08/20/2021 05:07:22 PM (3 years ago)
Author:
bradparbs
Message:

Update to version 1.1.1 from GitHub

Location:
published
Files:
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • published/tags/1.1.1/published.php

    r2584858 r2586110  
    33 * Plugin Name: Published
    44 * Description: Quickly and easily view the last published posts.
    5  * Version:     1.1.0
     5 * Version:     1.1.
    66 * Author:      Brad Parbs
    77 * Author URI:  https://bradparbs.com/
     
    1717use WP_Query;
    1818
    19 
    20 // Add new dashboard widget with list of published posts.
    21 add_action(
    22     'wp_dashboard_setup',
    23     function () {
    24         wp_add_dashboard_widget(
    25             'published',
    26             sprintf(
    27                 '<span><span class="dashicons dashicons-clock" style="padding-right: 10px"></span>%s</span>',
    28                 esc_attr__( 'Recently Published', 'published' )
    29             ),
    30             __NAMESPACE__ . '\\dashboard_widget'
    31         );
    32     }
    33 );
     19add_action( 'wp_dashboard_setup', __NAMESPACE__ . '\\add_dashboard_widget' );
    3420
    3521/**
    36  * Add dashboard widget for published posts.
     22 * Add new dashboard widget with list of recently published posts.
     23 */
     24function add_dashboard_widget() {
     25    $name = sprintf(
     26        '<span><span class="dashicons %s" style="padding-right: 10px"></span>%s</span>',
     27        apply_filters( 'published_widget_icon', 'dashicons-clock' ),
     28        apply_filters( 'published_widget_title', esc_attr__( 'Recently Published', 'published' ) )
     29    );
     30
     31    wp_add_dashboard_widget( 'published', $name, __NAMESPACE__ . '\\dashboard_widget' );
     32}
     33
     34/**
     35 * Add dashboard widget for recently published posts.
    3736 */
    3837function dashboard_widget() {
    39     $posts = new \WP_Query(
    40         [
    41             'post_type'      => get_post_types(),
    42             'orderby'        => 'date',
    43             'order'          => 'DESC',
    44             'posts_per_page' => 25,
    45             'no_found_rows'  => true,
    46         ]
    47     );
     38    $post_types = apply_filters( 'published_post_types_to_show', get_post_types() );
     39    $query_args = apply_filters( 'published_widget_query_args', [
     40        'post_type'      => $post_types,
     41        'orderby'        => 'date',
     42        'order'          => 'DESC',
     43        'posts_per_page' => 25,
     44        'no_found_rows'  => true,
     45    ] );
    4846
    49     $published = [];
    50 
    51     if ( $posts->have_posts() ) {
    52         while ( $posts->have_posts() ) {
    53             $posts->the_post();
    54 
    55             $published[] = [
    56                 'ID'      => get_the_ID(),
    57                 'title'   => get_the_title(),
    58                 'date'    => gmdate( 'F j, g:ia', get_the_time( 'U' ) ),
    59                 'preview' => get_preview_post_link(),
    60             ];
    61         }
    62     }
     47    $posts     = new WP_Query( $query_args );
     48    $published = get_published_posts( $posts );
    6349
    6450    printf(
     
    7157    );
    7258}
     59
    7360/**
    74  * Display published posts in widget.
     61 * Get the recently published posts to display in the dashboard widget.
     62 *
     63 * @param WP_Query $posts WP_Query object.
     64 *
     65 * @return array Array of recently published posts.
     66 */
     67function get_published_posts( $posts ) {
     68    $published = [];
     69
     70    if ( $posts->have_posts() ) {
     71        while ( $posts->have_posts() ) {
     72            $posts->the_post();
     73
     74            $add_to_published = apply_filters( 'schedules_show_in_widget', [
     75                'ID'      => get_the_ID(),
     76                'title'   => get_the_title(),
     77                'date'    => gmdate( 'F j, g:ia', get_the_time( 'U' ) ),
     78                'preview' => get_preview_post_link(),
     79            ] );
     80
     81            if ( isset( $add_to_published ) ) {
     82                $published[] = $add_to_published;
     83            }
     84        }
     85    }
     86
     87    return $published;
     88}
     89
     90/**
     91 * Display recently published posts in widget.
    7592 *
    7693 * @param array $posts Post data.
  • published/tags/1.1.1/readme.txt

    r2584858 r2586110  
    11=== Published ===
    2 Contributors: bradparbs
     2Contributors: bradparbs
    33Tags: posts, published, widget, dashboard, content, calendar
    44Requires at least: 5.2
    55Tested up to: 5.8
    6 Stable tag: 1.1.0
     6Stable tag: 1.1.
    77License: GPLv2 or later
    88Requires PHP: 5.6
     
    1313
    1414Quickly and easily view all your published posts.
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
  • published/trunk/published.php

    r2584858 r2586110  
    33 * Plugin Name: Published
    44 * Description: Quickly and easily view the last published posts.
    5  * Version:     1.1.0
     5 * Version:     1.1.
    66 * Author:      Brad Parbs
    77 * Author URI:  https://bradparbs.com/
     
    1717use WP_Query;
    1818
    19 
    20 // Add new dashboard widget with list of published posts.
    21 add_action(
    22     'wp_dashboard_setup',
    23     function () {
    24         wp_add_dashboard_widget(
    25             'published',
    26             sprintf(
    27                 '<span><span class="dashicons dashicons-clock" style="padding-right: 10px"></span>%s</span>',
    28                 esc_attr__( 'Recently Published', 'published' )
    29             ),
    30             __NAMESPACE__ . '\\dashboard_widget'
    31         );
    32     }
    33 );
     19add_action( 'wp_dashboard_setup', __NAMESPACE__ . '\\add_dashboard_widget' );
    3420
    3521/**
    36  * Add dashboard widget for published posts.
     22 * Add new dashboard widget with list of recently published posts.
     23 */
     24function add_dashboard_widget() {
     25    $name = sprintf(
     26        '<span><span class="dashicons %s" style="padding-right: 10px"></span>%s</span>',
     27        apply_filters( 'published_widget_icon', 'dashicons-clock' ),
     28        apply_filters( 'published_widget_title', esc_attr__( 'Recently Published', 'published' ) )
     29    );
     30
     31    wp_add_dashboard_widget( 'published', $name, __NAMESPACE__ . '\\dashboard_widget' );
     32}
     33
     34/**
     35 * Add dashboard widget for recently published posts.
    3736 */
    3837function dashboard_widget() {
    39     $posts = new \WP_Query(
    40         [
    41             'post_type'      => get_post_types(),
    42             'orderby'        => 'date',
    43             'order'          => 'DESC',
    44             'posts_per_page' => 25,
    45             'no_found_rows'  => true,
    46         ]
    47     );
     38    $post_types = apply_filters( 'published_post_types_to_show', get_post_types() );
     39    $query_args = apply_filters( 'published_widget_query_args', [
     40        'post_type'      => $post_types,
     41        'orderby'        => 'date',
     42        'order'          => 'DESC',
     43        'posts_per_page' => 25,
     44        'no_found_rows'  => true,
     45    ] );
    4846
    49     $published = [];
    50 
    51     if ( $posts->have_posts() ) {
    52         while ( $posts->have_posts() ) {
    53             $posts->the_post();
    54 
    55             $published[] = [
    56                 'ID'      => get_the_ID(),
    57                 'title'   => get_the_title(),
    58                 'date'    => gmdate( 'F j, g:ia', get_the_time( 'U' ) ),
    59                 'preview' => get_preview_post_link(),
    60             ];
    61         }
    62     }
     47    $posts     = new WP_Query( $query_args );
     48    $published = get_published_posts( $posts );
    6349
    6450    printf(
     
    7157    );
    7258}
     59
    7360/**
    74  * Display published posts in widget.
     61 * Get the recently published posts to display in the dashboard widget.
     62 *
     63 * @param WP_Query $posts WP_Query object.
     64 *
     65 * @return array Array of recently published posts.
     66 */
     67function get_published_posts( $posts ) {
     68    $published = [];
     69
     70    if ( $posts->have_posts() ) {
     71        while ( $posts->have_posts() ) {
     72            $posts->the_post();
     73
     74            $add_to_published = apply_filters( 'schedules_show_in_widget', [
     75                'ID'      => get_the_ID(),
     76                'title'   => get_the_title(),
     77                'date'    => gmdate( 'F j, g:ia', get_the_time( 'U' ) ),
     78                'preview' => get_preview_post_link(),
     79            ] );
     80
     81            if ( isset( $add_to_published ) ) {
     82                $published[] = $add_to_published;
     83            }
     84        }
     85    }
     86
     87    return $published;
     88}
     89
     90/**
     91 * Display recently published posts in widget.
    7592 *
    7693 * @param array $posts Post data.
  • published/trunk/readme.txt

    r2584858 r2586110  
    11=== Published ===
    2 Contributors: bradparbs
     2Contributors: bradparbs
    33Tags: posts, published, widget, dashboard, content, calendar
    44Requires at least: 5.2
    55Tested up to: 5.8
    6 Stable tag: 1.1.0
     6Stable tag: 1.1.
    77License: GPLv2 or later
    88Requires PHP: 5.6
     
    1313
    1414Quickly and easily view all your published posts.
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
Note: See TracChangeset for help on using the changeset viewer.