WordPress.org

Make WordPress Core

Changes between Version 3 and Version 4 of Ticket #26877, comment 3


Ignore:
Timestamp:
06/13/2015 07:01:12 PM (6 years ago)
Author:
MikeSchinkel
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #26877, comment 3

    v3 v4  
    77> You want to subclass a model so that you can use a theme function on one of the global `$post`'s properties?
    88
    9 I don't understand what you mean by _"use a theme function"_;  Are you saying that because I chose `title()` as the one methods I showed ''(vs. one of the other 25+ methods in my actual class)'' that I am ''"using a theme function?"'' If yes, note that rather than overwhelm the reader I was trying to show the smallest example I could, and yes `$post->title()` is not that beneficial. But `$post->the_video_embed()`, `$post->the_featured_image()` and `$post->do_show_excerpt()` might help you visualize it better.
     9I don't understand what you mean by ''"use a theme function"'';  Are you saying that because I chose `title()` as the one methods I showed ''(vs. one of the other 25+ methods in my actual class)'' that I am ''"using a theme function?"'' If yes, note that rather than overwhelm the reader I was trying to show the smallest example I could, and yes `$post->title()` is not that beneficial. But `$post->the_video_embed()`, `$post->the_featured_image()` and `$post->do_show_excerpt()` might help you visualize it better.
    1010
    1111What I want to do is be able to add properties and behavior to the `$post` object so that when I pass the `$post` object around, especially through other people's code that the properties and behavior follow along with it. This is just OOP 101 and wasn't something I though needed to be made highly convincing.