Changeset 1688778
- Timestamp:
- 07/01/2017 03:57:07 PM (9 years ago)
- File:
-
- 1 edited
-
optimality/trunk/markup/post.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
optimality/trunk/markup/post.php
r1688504 r1688778 15 15 const SMDESC = 'post_smdesc'; 16 16 17 public $section; 18 17 19 18 20 function __construct($object) … … 22 24 23 25 26 function __invoke($target, $option) 27 { 28 if (count($object = get_the_terms($this->proto, 'category'))) 29 { 30 $this->section = $object[0]->name; 31 } 32 33 return parent::__invoke($target, $option); 34 } 35 36 24 37 function getMeta($option) 25 38 { 26 $object = get_the_terms($this->proto, 'category');27 28 39 return array_merge(parent::getMeta($option), 29 40 [ 30 'article:section' => empty($object) ? NULL : $object[0]->name,41 'article:section' => $this->section, 31 42 'article:tag' => array_map(function($object) 32 43 { … … 40 51 function getJson($option) 41 52 { 42 $object = get_the_terms($this->proto, 'category');43 44 53 return array_merge(parent::getJson($option), 45 54 [ 46 55 '@type' => 'Article', 47 'articleSection' => empty($object) ? NULL : $object[0]->name,56 'articleSection' => $this->section, 48 57 'keywords' => implode(',', array_map(function($object) 49 58 {
Note: See TracChangeset
for help on using the changeset viewer.