WordPress.org

Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #26877, comment 3


Ignore:
Timestamp:
02/17/2014 08:55:25 PM (8 years ago)
Author:
MikeSchinkel
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #26877, comment 3

    initial v1  
    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 had to be made highly convincing.