PluginProbe
Property Hive / 1.4.49
Property Hive v1.4.49
2.3.1 2.3.0 2.2.6 2.2.5 2.2.4 2.2.3 2.2.2 1.4.46 1.4.47 1.4.48 1.4.49 1.4.5 1.4.50 1.4.51 1.4.52 1.4.53 1.4.54 1.4.55 1.4.56 1.4.57 1.4.58 1.4.59 1.4.6 1.4.60 1.4.61 All 261 releases
propertyhive / includes / class-ph-yoast-seo.php

class-ph-yoast-seo.php in Property Hive 1.4.49, at includes/class-ph-yoast-seo.php

79 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit; // Exit if accessed directly
5 }
6
7 /**
8 * Serve properties using the REST API
9 *
10 * @class PH_Rest_Api
11 * @version 1.0.0
12 * @package PropertyHive/Classes/
13 * @category Class
14 * @author PropertyHive
15 */
16 class PH_Yoast_API {
17
18 /** @var PH_Rest_Api The single instance of the class */
19 protected static $_instance = null;
20
21 /**
22 * Hook in methods
23 */
24 public static function init() {
25 add_filter( 'wpseo_sitemap_exclude_taxonomy', array( __CLASS__, 'sitemap_exclude_taxonomy' ), 10, 2 );
26 add_filter( 'wpseo_metabox_prio', array( __CLASS__, 'yoast_meta_box_to_bottom') );
27 add_filter( 'manage_edit-property_columns', array( __CLASS__, 'yoast_remove_columns') );
28 add_filter( 'wpseo_exclude_from_sitemap_by_post_ids', array( __CLASS__, 'sitemap_exclude_off_market') );
29 }
30
31 public static function sitemap_exclude_taxonomy( $value, $taxonomy ) {
32 $taxonomy_objects = get_object_taxonomies( 'property', 'objects' );
33 $taxonomies = array();
34
35 if ( !empty($taxonomy_objects) )
36 {
37 foreach ( $taxonomy_objects as $taxonomy_name => $object )
38 {
39 $taxonomies[] = $taxonomy_name;
40 }
41 }
42 if (
43 in_array($taxonomy, $taxonomies)
44 )
45 {
46 return true;
47 }
48 }
49
50 public static function yoast_meta_box_to_bottom() {
51 return 'low';
52 }
53
54 public static function yoast_remove_columns( $columns ) {
55 unset( $columns['wpseo-score'] );
56 unset( $columns['wpseo-score-readability'] );
57 unset( $columns['wpseo-title'] );
58 unset( $columns['wpseo-metadesc'] );
59 unset( $columns['wpseo-focuskw'] );
60 return $columns;
61 }
62
63 public static function sitemap_exclude_off_market() {
64 return get_posts(array(
65 'fields' => 'ids',
66 'posts_per_page' => -1,
67 'post_type' => 'property',
68 'meta_query' => array(
69 array(
70 'key' => '_on_market',
71 'value' => '',
72 )
73 )
74 ));
75 }
76
77 }
78
79 PH_Yoast_API::init();