PluginProbe
Parse.ly / 3.19.2
Parse.ly v3.19.2
3.24.1 3.24.0 3.23.7 3.23.6 3.23.5 3.23.4 3.23.3 3.16.0 3.16.1 3.16.2 3.16.3 3.16.4 3.17.0 3.18.0 3.18.1 3.19.0 3.19.1 3.19.2 3.19.3 3.2.0 3.2.1 3.20.0 3.20.1 3.20.2 3.20.3 All 105 releases
wp-parsely / src / Metadata / class-page-for-posts-builder.php

class-page-for-posts-builder.php in Parse.ly 3.19.2, at src/Metadata/class-page-for-posts-builder.php

47 lines 888 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Page For Posts Metadata Builder class
4 *
5 * @package Parsely
6 * @since 3.4.0
7 */
8
9 declare(strict_types=1);
10
11 namespace Parsely\Metadata;
12
13 use Parsely\Utils\Utils;
14
15 /**
16 * Implements abstract Metadata Builder class to generate the metadata array
17 * for a page for posts.
18 *
19 * @since 3.4.0
20 */
21 class Page_For_Posts_Builder extends Metadata_Builder {
22 /**
23 * Generates the metadata object by calling the build_* methods and
24 * returns the value.
25 *
26 * @since 3.4.0
27 *
28 * @return array<string, mixed>
29 */
30 public function get_metadata(): array {
31 $this->build_basic();
32 $this->build_headline();
33 $this->build_url();
34
35 return $this->metadata;
36 }
37
38 /**
39 * Populates the `headline` field in the metadata object.
40 *
41 * @since 3.4.0
42 */
43 private function build_headline(): void {
44 $this->metadata['headline'] = get_the_title( Utils::get_page_for_posts( true ) );
45 }
46 }
47