| Conditions | 4 |
| Paths | 5 |
| Total Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 42 | public function wp_head() { |
||
| 43 | |||
| 44 | // Bail out if `wl_jsonld_enabled` isn't enabled. |
||
| 45 | if ( ! apply_filters( 'wl_jsonld_enabled', true ) ) { |
||
| 46 | return; |
||
| 47 | } |
||
| 48 | |||
| 49 | // Determine whether this is the home page or whether we're displaying a single post. |
||
| 50 | $is_homepage = is_home() || is_front_page(); |
||
| 51 | $post_id = is_singular() ? get_the_ID() : null; |
||
| 52 | |||
| 53 | // Get the JSON-LD. |
||
| 54 | $jsonld = json_encode( $this->jsonld_service->get_jsonld( $is_homepage, $post_id ) ); |
||
| 55 | // Finally print the JSON-LD out. |
||
| 56 | ?> |
||
| 57 | <script type="application/ld+json" id="wl-jsonld"><?php echo $jsonld; ?></script> |
||
| 58 | <?php |
||
| 59 | |||
| 60 | } |
||
| 61 | |||
| 63 |