Plugin Directory

Changeset 2586109

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

Update to version 1.1.0 from GitHub

Location:
pages
Files:
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • pages/tags/1.1.0/pages.php

    r2585740 r2586109  
    22/**
    33 * Plugin Name: Pages
    4  * Description: Quickly and easily view your pages in the dashboard.
    5  * Version:     1.0.0
     4 * Description: Quickly and easily view your pages in the dashboard.
     5 * Version:     1..0
    66 * Author:      Brad Parbs
    77 * Author URI:  https://bradparbs.com/
     
    1717use WP_Query;
    1818
    19 // Add new dashboard widget with list of draft posts.
    20 add_action(
    21     'wp_dashboard_setup',
    22     function () {
    23         wp_add_dashboard_widget(
    24             'pages',
    25             sprintf(
    26                 '<span><span class="dashicons dashicons-admin-page" style="padding-right: 10px"></span>%s</span>',
    27                 esc_attr__( 'Recent Pages', 'pages' )
    28             ),
    29             __NAMESPACE__ . '\\dashboard_widget'
    30         );
    31     }
    32 );
     19add_action( 'wp_dashboard_setup', __NAMESPACE__ . '\\add_dashboard_widget' );
    3320
    3421/**
    35  * Add dashboard widget for draft posts.
     22 * Add new dashboard widget with list of recently modified pages.
     23 */
     24function add_dashboard_widget() {
     25    $name = sprintf(
     26        '<span><span class="dashicons %s" style="padding-right: 10px"></span>%s</span>',
     27        apply_filters( 'pages_widget_icon', 'dashicons-admin-page' ),
     28        apply_filters( 'pages_widget_title', esc_attr__( 'Recent Pages', 'pages' ) )
     29    );
     30
     31    wp_add_dashboard_widget( 'pages', $name, __NAMESPACE__ . '\\dashboard_widget' );
     32}
     33
     34/**
     35 * Add dashboard widget for recently modified pages.
    3636 */
    3737function dashboard_widget() {
    38     $posts = new WP_Query(
    39         [
    40             'post_type'      => 'page',
    41             'orderby'        => 'modified',
    42             'post_status'    => 'publish',
    43             'order'          => 'DESC',
    44             'posts_per_page' => 25,
    45             'no_found_rows'  => true,
    46         ]
     38    $query_args = apply_filters( 'pages_widget_query_args', [
     39        'post_type'      => 'page',
     40        'orderby'        => 'modified',
     41        'post_status'    => 'publish',
     42        'order'          => 'DESC',
     43        'posts_per_page' => 25,
     44        'no_found_rows'  => true,
     45    ] );
     46
     47    $posts     = new WP_Query( $query_args );
     48    $pages = get_pages_posts( $posts );
     49
     50    printf(
     51        '<div id="pages-posts-widget-wrapper">
     52            <div id="pages-posts-widget" class="activity-block" style="padding-top: 0;">
     53                <ul>%s</ul>
     54            </div>
     55        </div>',
     56        display_pages_in_widget( $pages ) // phpcs:ignore
    4757    );
     58
    4859
     60
     61
     62
     63
     64
     65
     66
     67
    4968    $pages = [];
    5069
     
    5372            $posts->the_post();
    5473
    55             $pages[] = [
     74            $ [
    5675                'ID'      => get_the_ID(),
    5776                'title'   => get_the_title(),
    5877                'date'    => gmdate( 'F j, g:ia', get_the_time( 'U' ) ),
    5978                'preview' => get_preview_post_link(),
    60             ];
     79            ] );
     80
     81            if ( isset( $add_to_pages ) ) {
     82                $pages[] = $add_to_pages;
     83            }
    6184        }
    6285    }
    6386
    64     printf(
    65         '<div id="pages-widget-wrapper">
    66             <div id="pages-widget" class="activity-block" style="padding-top: 0;">
    67                 <ul>%s</ul>
    68             </div>
    69         </div>',
    70         display_pages_in_widget( $pages ) // phpcs:ignore
    71     );
     87    return $pages;
    7288}
     89
    7390/**
    74  * Display draft posts in widget.
     91 * Display s in widget.
    7592 *
    7693 * @param array $posts Post data.
  • pages/tags/1.1.0/readme.txt

    r2585740 r2586109  
    44Requires at least: 5.2
    55Tested up to: 5.8
    6 Stable tag: 1.0.0
     6Stable tag: 1..0
    77License: GPLv2 or later
    88Requires PHP: 5.6
     
    1212== Description ==
    1313
    14 Quickly and easily view your pages in the dashboard.
     14Quickly and easily view all your recently modified pages in the dashboard.
     15
     16== Availiable filters ==
     17
     18`pages_widget_icon` - The dashicon to use for the dashboard widget.
     19`pages_widget_title` - The title to use for the dashboard widget.
     20`pages_widget_query_args` - An array of arguments to pass to the WP_Query.
     21`pages_show_in_widget` - Will pass ID of each post, returning `false` will not add it to the dashboard widget.
     22
     23== Changelog ==
     24
     25= 1.1.0 =
     26
     27* Added more filters
     28
     29= 1.0.0 =
     30
     31* Initial release
  • pages/trunk/pages.php

    r2585740 r2586109  
    22/**
    33 * Plugin Name: Pages
    4  * Description: Quickly and easily view your pages in the dashboard.
    5  * Version:     1.0.0
     4 * Description: Quickly and easily view your pages in the dashboard.
     5 * Version:     1..0
    66 * Author:      Brad Parbs
    77 * Author URI:  https://bradparbs.com/
     
    1717use WP_Query;
    1818
    19 // Add new dashboard widget with list of draft posts.
    20 add_action(
    21     'wp_dashboard_setup',
    22     function () {
    23         wp_add_dashboard_widget(
    24             'pages',
    25             sprintf(
    26                 '<span><span class="dashicons dashicons-admin-page" style="padding-right: 10px"></span>%s</span>',
    27                 esc_attr__( 'Recent Pages', 'pages' )
    28             ),
    29             __NAMESPACE__ . '\\dashboard_widget'
    30         );
    31     }
    32 );
     19add_action( 'wp_dashboard_setup', __NAMESPACE__ . '\\add_dashboard_widget' );
    3320
    3421/**
    35  * Add dashboard widget for draft posts.
     22 * Add new dashboard widget with list of recently modified pages.
     23 */
     24function add_dashboard_widget() {
     25    $name = sprintf(
     26        '<span><span class="dashicons %s" style="padding-right: 10px"></span>%s</span>',
     27        apply_filters( 'pages_widget_icon', 'dashicons-admin-page' ),
     28        apply_filters( 'pages_widget_title', esc_attr__( 'Recent Pages', 'pages' ) )
     29    );
     30
     31    wp_add_dashboard_widget( 'pages', $name, __NAMESPACE__ . '\\dashboard_widget' );
     32}
     33
     34/**
     35 * Add dashboard widget for recently modified pages.
    3636 */
    3737function dashboard_widget() {
    38     $posts = new WP_Query(
    39         [
    40             'post_type'      => 'page',
    41             'orderby'        => 'modified',
    42             'post_status'    => 'publish',
    43             'order'          => 'DESC',
    44             'posts_per_page' => 25,
    45             'no_found_rows'  => true,
    46         ]
     38    $query_args = apply_filters( 'pages_widget_query_args', [
     39        'post_type'      => 'page',
     40        'orderby'        => 'modified',
     41        'post_status'    => 'publish',
     42        'order'          => 'DESC',
     43        'posts_per_page' => 25,
     44        'no_found_rows'  => true,
     45    ] );
     46
     47    $posts     = new WP_Query( $query_args );
     48    $pages = get_pages_posts( $posts );
     49
     50    printf(
     51        '<div id="pages-posts-widget-wrapper">
     52            <div id="pages-posts-widget" class="activity-block" style="padding-top: 0;">
     53                <ul>%s</ul>
     54            </div>
     55        </div>',
     56        display_pages_in_widget( $pages ) // phpcs:ignore
    4757    );
     58
    4859
     60
     61
     62
     63
     64
     65
     66
     67
    4968    $pages = [];
    5069
     
    5372            $posts->the_post();
    5473
    55             $pages[] = [
     74            $ [
    5675                'ID'      => get_the_ID(),
    5776                'title'   => get_the_title(),
    5877                'date'    => gmdate( 'F j, g:ia', get_the_time( 'U' ) ),
    5978                'preview' => get_preview_post_link(),
    60             ];
     79            ] );
     80
     81            if ( isset( $add_to_pages ) ) {
     82                $pages[] = $add_to_pages;
     83            }
    6184        }
    6285    }
    6386
    64     printf(
    65         '<div id="pages-widget-wrapper">
    66             <div id="pages-widget" class="activity-block" style="padding-top: 0;">
    67                 <ul>%s</ul>
    68             </div>
    69         </div>',
    70         display_pages_in_widget( $pages ) // phpcs:ignore
    71     );
     87    return $pages;
    7288}
     89
    7390/**
    74  * Display draft posts in widget.
     91 * Display s in widget.
    7592 *
    7693 * @param array $posts Post data.
  • pages/trunk/readme.txt

    r2585740 r2586109  
    44Requires at least: 5.2
    55Tested up to: 5.8
    6 Stable tag: 1.0.0
     6Stable tag: 1..0
    77License: GPLv2 or later
    88Requires PHP: 5.6
     
    1212== Description ==
    1313
    14 Quickly and easily view your pages in the dashboard.
     14Quickly and easily view all your recently modified pages in the dashboard.
     15
     16== Availiable filters ==
     17
     18`pages_widget_icon` - The dashicon to use for the dashboard widget.
     19`pages_widget_title` - The title to use for the dashboard widget.
     20`pages_widget_query_args` - An array of arguments to pass to the WP_Query.
     21`pages_show_in_widget` - Will pass ID of each post, returning `false` will not add it to the dashboard widget.
     22
     23== Changelog ==
     24
     25= 1.1.0 =
     26
     27* Added more filters
     28
     29= 1.0.0 =
     30
     31* Initial release
Note: See TracChangeset for help on using the changeset viewer.