WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 5 years ago

#20259 closed enhancement (duplicate)

WP_Post

Reported by: braydonf Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: Cc:

Description

A class to group all related template tags/functions for a post so that the global $post variable isn't required to be used from template tags.

All existing template tags would continue to work, as-is, and this would provide a new API for writing templates.

Each post_type could have it's own class that would be extended based on a standard WP_Post class.

Here are some ideas for similar functionality and use:

Template TagWP_Post function
get_permalink()$post->permalink()
the_title()$post->title()
the_content()$post->body()
the_excerpt()$post->excerpt()
the_date()$post->date()
get_post_meta()$post->meta()
get_children()$post->attachments()
the_post_thumbnail()$post->image()

Change History (3)

#1 @ocean90
9 years ago

Duplicate of #12267?

#2 @nacin
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

#3 @swissspidy
5 years ago

Duplicate of #12267.

Note: See TracTickets for help on using tickets.