Last active
October 6, 2015 19:17
-
-
Save lloc/3040397 to your computer and use it in GitHub Desktop.
My extended sitemap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function mxs_flush_rules() { | |
global $wp_rewrite; | |
$wp_rewrite->flush_rules(); | |
} | |
register_activation_hook( __FILE__, 'mxs_flush_rules' ); | |
register_deactivation_hook( __FILE__, 'mxs_flush_rules' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function mxs_add_modules() { | |
global $bwp_gxs; | |
$bwp_gxs->add_module( 'specials' ); | |
} | |
add_action( 'bwp_gxs_modules_built', 'mxs_add_modules' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function mxs_add_rules() { | |
return array( 'specials\.xml' => 'index.php?gxs_module=specials' ); | |
} | |
add_filter( 'bwp_gxs_rewrite_rules', 'mxs_add_rules' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function mxs_module_dir() { | |
return plugin_dir_path( __FILE__ ) . 'modules/'; | |
} | |
add_filter( 'bwp_gxs_module_dir', 'mxs_module_dir' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class BWP_GXS_MODULE_SPECIALS extends BWP_GXS_MODULE { | |
public function __construct() { | |
$this->set_current_time(); | |
$this->build_data(); | |
} | |
public function build_data() { | |
global $wpdb; | |
$sql = "SELECT p.ID, p.post_modified, COUNT( p.ID ) FROM {$wpdb->posts} p, {$wpdb->postmeta} m WHERE p.ID = m.post_id AND m.meta_key IN( 'latitude', 'longitude' ) GROUP BY p.ID, p.post_modified HAVING COUNT( p.ID ) = 2"; | |
$data = array(); | |
foreach ( $wpdb->get_results( $sql ) as $post ) { | |
$data = $this->init_data( $data ); | |
$data['location'] = home_url( '/import/index.php?post_id=' . $post->ID ); | |
$data['lastmod'] = $this->format_lastmod( strtotime( $post->post_modified ) ); | |
$data['freq'] = $this->cal_frequency( null, $post->post_modified ); | |
$data['priority'] = '1.0'; | |
$this->data[] = $data; | |
} | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment