Plugin Directory

Changeset 2778880

Timestamp:
09/01/2022 02:37:45 PM (2 years ago)
Author:
shooper
Message:

Fix debug warnings about missing array keys. Tested up to 6.0.2

Location:
page-template-usage-info/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • page-template-usage-info/trunk/fti_page_templates.php

    r2195003 r2778880  
    8585        global $wpdb;
    8686
    87         if ($template_filename != '') {
     87        if ($template_filename != '') {
    8888            $sql = $wpdb->prepare("SELECT p.ID, u.display_name AS post_author, post_date, post_title, post_status, post_modified, post_content FROM " . $wpdb->prefix . "posts p INNER JOIN " . $wpdb->prefix . "users u ON p.post_author = u.ID  LEFT JOIN " . $wpdb->prefix . "postmeta pm ON p.ID = pm.post_id AND pm.meta_key = '_wp_page_template' WHERE p.post_type = 'page' AND p.post_status IN ('publish', 'draft')  AND pm.meta_value = '%s'", $template_filename);
    8989        } else {
     
    137137        echo '</tr>';
    138138
    139         // Loop through the themes
     139        // Loop through the tes
    140140        foreach ($templates as $template_name => $template_filename) {
    141141            echo '<tr>';
    142             echo sprintf('<td>%s</td><td>%s</td><td><a href="edit.php?post_type=page&page=fti_page_templates&template=%s">%d</a></td>', $template_name, $template_filename, $template_filename, $templateUse[$template_filename]->pages_using);
     142            $pages_using = 0;
     143            if ( isset($templateUse[$template_filename]) ) {
     144                $pages_using = $templateUse[$template_filename];
     145            }
     146            echo sprintf('<td>%s</td><td>%s</td><td><a href="edit.php?post_type=page&page=fti_page_templates&template=%s">%d</a></td>', $template_name, $template_filename, $template_filename, $pages_using);
    143147            echo '</tr>';
    144148        }
  • page-template-usage-info/trunk/readme.txt

    r2195001 r2778880  
    33Tags: templates, page, reporting, blocks, gutenberg, reports, management, auditing
    44Requires at least: 3.0.1
    5 Tested up to: 5.3.0
    6 Stable tag: 1.3.1
     5Tested up to:
     6Stable tag: 1.3.
    77Text Domain: pagetemplateusageinfo
    88License: GPLv2 or later
     
    2424== Changelog ==
    2525
     26
     27
     28
     29
     30
     31
     32
    2633= 1.3 =
    2734* Adds a new column to show if this page was created with the Gutenberg editor
Note: See TracChangeset for help on using the changeset viewer.