WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#8497 closed enhancement (fixed)

support single-lined Template Name comment blocks for Templates

Reported by: DD32 Owned by: westi
Milestone: 2.8 Priority: normal
Severity: normal Version: 2.7
Component: Themes Keywords: has-patch needs-testing
Focuses: 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 (5)

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

Download all attachments as: .zip

Change History (16)

DD325 years ago

comment:1 DD325 years ago

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

comment:2 westi5 years ago

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

Denis-de-Bernardy5 years ago

updated and enhanced patch

comment:3 Denis-de-Bernardy5 years ago

  • Keywords needs-testing added

comment:4 westi5 years ago

  • 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!

Denis-de-Bernardy5 years ago

comment:5 Denis-de-Bernardy5 years ago

  • Keywords needs-patch removed

done

comment:6 westi5 years ago

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

(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.

Denis-de-Bernardy5 years ago

fix potential cron job issues

comment:7 Denis-de-Bernardy5 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

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

comment:8 Denis-de-Bernardy5 years ago

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

Denis-de-Bernardy5 years ago

fix both themes and plugins update cron

comment:9 Denis-de-Bernardy5 years ago

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.

comment:10 westi5 years ago

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

comment:11 westi5 years ago

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

(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.