Skip to content

Latest commit

 

History

History
13 lines (9 loc) · 394 Bytes

php-conventions.md

File metadata and controls

13 lines (9 loc) · 394 Bytes

PHP Conventions

Factory Method

Many classes—including all post types classes (which extend Post_Object) and taxonomy classes (which extend Term_Object )—contain a static factory() method. This is used to retrieve a specific instance of a class. Typically, an id is passed to retrieve it.

$story = Feed_Story::factory( $post_id );
echo $story->get_source_name();