-
Notifications
You must be signed in to change notification settings - Fork 0
/
tristatecr-listing.php
136 lines (112 loc) · 3.81 KB
/
tristatecr-listing.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<?php
/**
* Tristate Commercial Listing
*
* @package TRISTATECRLISTING
* @author CodePixelz
* @license gplv2
* @version 1.0.0
*
* @wordpress-plugin
* Plugin Name: Tristatecr Listing
* Plugin URI: https://tristatecr.com/
* Description: Tristate Commercial property listings filters.
* Version: 1.0.0
* Author: CodePixelz
* Author URI: https://codepixelzmedia.com.np/
* Text Domain: tristatecr-listing
* Domain Path: /languages
* License: GPLv2
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
*
* You should have received a copy of the GNU General Public License
* along with Tristate Commercial Listing. If not, see <https://www.gnu.org/licenses/gpl-2.0.html/>.
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) exit;
/**
* HELPER COMMENT START
*
* This file contains the main information about the plugin.
* It is used to register all components necessary to run the plugin.
*
* The comment above contains all information about the plugin
* that are used by WordPress to differenciate the plugin and register it properly.
* It also contains further PHPDocs parameter for a better documentation
*
* The function TRISTATECRLISTING() is the main function that you will be able to
* use throughout your plugin to extend the logic. Further information
* about that is available within the sub classes.
*
* HELPER COMMENT END
*/
// Plugin name
define( 'TRISTATECRLISTING_NAME', 'Tristate Commercial Listing' );
// Plugin version
define( 'TRISTATECRLISTING_VERSION', '1.0.0' );
// Plugin Root File
define( 'TRISTATECRLISTING_PLUGIN_FILE', __FILE__ );
// Plugin base
define( 'TRISTATECRLISTING_PLUGIN_BASE', plugin_basename( TRISTATECRLISTING_PLUGIN_FILE ) );
// Plugin Folder Path
define( 'TRISTATECRLISTING_PLUGIN_DIR', plugin_dir_path( TRISTATECRLISTING_PLUGIN_FILE ) );
// Plugin Folder URL
define( 'TRISTATECRLISTING_PLUGIN_URL', plugin_dir_url( TRISTATECRLISTING_PLUGIN_FILE ) );
/**
* Load the main class for the core functionality
*/
require_once TRISTATECRLISTING_PLUGIN_DIR . 'core/class-tristatecr-listing.php';
require_once TRISTATECRLISTING_PLUGIN_DIR . 'demo/cli-commands.php';
/**
* The main function to load the only instance
* of our master class.
*
* @author CodePixelz
* @since 1.0.0
* @return object|Tristatecr_Listing
*/
function TRISTATECRLISTING() {
return Tristatecr_Listing::instance();
}
TRISTATECRLISTING();
// $f_name = 'https://docs.google.com/spreadsheets/d/1R0-lie_XfdirjxoaXZ59w4etaQPWFBD5c45i-5CaaMk/gviz/tq?tqx=out:csv&sheet=0';
// if (($handle = fopen($f_name, "r")) !== FALSE) {
// $row = 0;
// while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
// $row++;
// if ($row == 1) {
// $header = $data;
// array_walk($header, function(&$item) {
// $item = sanitize_title( $item );
// $item = strtolower( str_replace('-', '_', $item) );
// });
// continue;
// }
// // Data row
// $item = array_combine($header, $data);
// // print_r($item);
// // $id = ($item);
// // $checksum = md5( json_encode( $item ) );
// // $message = "- Processing #$id";
// }
// }
// // die();
function custom_brokers_template($single_template)
{
global $post;
if ('brokers' === $post->post_type) {
$single_template = plugin_dir_path(__FILE__) . '/core/single-brokers.php';
}
if ('properties' === $post->post_type) {
$single_template = plugin_dir_path(__FILE__) . '/core/single-properties.php';
}
return $single_template;
}
add_filter('single_template', 'custom_brokers_template');
/**
* Proper way to enqueue scripts and styles
*/
function tristate_cr_single_scripts() {
wp_enqueue_style( 'single-styles', TRISTATECRLISTING_PLUGIN_URL. 'core/includes/assets/css/frontend-styles.css', array(), '1.0.0' );
}
add_action( 'wp_enqueue_scripts', 'tristate_cr_single_scripts' );