Ticket #8497 (closed enhancement: fixed)

Opened 3 years ago

Last modified 3 years ago

support single-lined Template Name comment blocks for Templates

Reported by: DD32 Owned by: westi
Priority: normal Milestone: 2.8
Component: Themes Version: 2.7
Severity: normal Keywords: has-patch needs-testing
Cc:

Description

at present, The Template system requires that the Template Names are on their own lines, Eg:

/*
Template Name: Snarfer
*/

Using something such as:

/* Template Name: Snarfer */

or

<?php // Template Name: Snarfer ?>

will result in Snarfer */ and Snarfer ?> respectively.

The attached patch causes the template locator to ignore anything after a closing comment marker(*/) as well as end-php markers(?>)

(As promised for Anthony)

Attachments

8479.diff Download (852 bytes) - added by DD32 3 years ago.
8497.diff Download (4.8 KB) - added by Denis-de-Bernardy 3 years ago.
updated and enhanced patch
8497.2.diff Download (5.0 KB) - added by Denis-de-Bernardy 3 years ago.
8497.3.diff Download (5.6 KB) - added by Denis-de-Bernardy 3 years ago.
fix potential cron job issues
8497-cron.diff Download (1.0 KB) - added by Denis-de-Bernardy 3 years ago.
fix both themes and plugins update cron

Change History

DD323 years ago

comment:1   DD323 years ago

I transposed the minor digits in the patch name.. but rest assured, Its for this ticket.

  • Owner set to westi
  • Status changed from new to assigned

updated and enhanced patch

  • Keywords needs-testing added
  • Keywords needs-patch added

Denis, I take the new patch is intending to apply this rule to all the other headers?

If so, we should create a cleanup function containing the regex call and just call that.

Named something like _cleanup_header_comment() but preferably snapier!

  • Keywords needs-patch removed

done

  • Status changed from assigned to closed
  • Resolution set to fixed

(In [11168]) Support single line Template Name comment blocks for theme Templates and apply same cleanup to all header lines. Fixes #8497 props DD32 and Denis-de-Bernardy.

fix potential cron job issues

  • Status changed from closed to reopened
  • Resolution fixed deleted

oh, you just committed it. I had noticed a potential potential cron job issue. new patch against current trunk arriving in a sec.

the cron that checks for theme updates uses get_themes(), so we need to make sure the function is defined when that gets triggered.

fix both themes and plugins update cron

there. fixes both the theme and the plugin update check cron -- else we'd get fatal errors when they're triggered from the front end.

I think I would prefer to move the new function to wp-includes/functions.php where it will always be available.

  • Status changed from reopened to closed
  • Resolution set to fixed

(In [11170]) Move _cleanup_header_comment() to wp-includes so it is always available. Fixes #8497 props Denis-de-Bernardy.

Note: See TracTickets for help on using tickets.