WordPress.org

Make WordPress Core

#20259 closed enhancement (duplicate)

WP_Post

Reported by: braydonf Owned by:
Priority: normal Milestone:
Component: General Version:
Severity: normal Keywords:
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 (2)

comment:1 ocean9015 months ago

Duplicate of #12267?

comment:2 nacin15 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.