本文整理汇总了PHP中wpseo_xml_sitemaps_base_url函数的典型用法代码示例。如果您正苦于以下问题:PHP wpseo_xml_sitemaps_base_url函数的具体用法?PHP wpseo_xml_sitemaps_base_url怎么用?PHP wpseo_xml_sitemaps_base_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpseo_xml_sitemaps_base_url函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: wpseo_hook_sitemap_index
public function wpseo_hook_sitemap_index()
{
$now = date('c', time());
$sitemap_url = wpseo_xml_sitemaps_base_url('ecwid-sitemap.xml');
return <<<XML
\t\t<sitemap>
\t\t\t<loc>{$sitemap_url}</loc>
\t\t\t<lastmod>{$now}</lastmod>
\t\t</sitemap>
XML;
}
开发者ID:johnmanlove,项目名称:Galveston_Island,代码行数:11,代码来源:class-ecwid-integration-wpseo.php
示例2: __
WPSEO_Local_Admin_Wrappers::checkbox('use_multiple_locations', '', __('Use multiple locations', 'yoast-local-seo'));
echo '</div>';
echo '<div id="show-single-location" style="clear: both; ' . (wpseo_has_multiple_locations() ? 'display: none;' : '') . '">';
WPSEO_Local_Admin_Wrappers::textinput('location_name', __('Business name', 'yoast-local-seo'));
WPSEO_Local_Admin_Wrappers::select('business_type', __('Business type:', 'yoast-local-seo'), $wpseo_local_core->get_local_business_types());
echo '<p class="desc label" style="border:none; margin-bottom: 0;">' . sprintf(__('If your business type is not listed, please read %sthe FAQ entry%s.', 'yoast-local-seo'), '<a href="http://kb.yoast.com/article/49-my-business-is-not-listed-can-you-add-it" target="_blank">', '</a>') . '</p>';
WPSEO_Local_Admin_Wrappers::textinput('location_address', __('Business address', 'yoast-local-seo'));
WPSEO_Local_Admin_Wrappers::textinput('location_city', __('Business city', 'yoast-local-seo'));
WPSEO_Local_Admin_Wrappers::textinput('location_state', __('Business state', 'yoast-local-seo'));
WPSEO_Local_Admin_Wrappers::textinput('location_zipcode', __('Business zipcode', 'yoast-local-seo'));
WPSEO_Local_Admin_Wrappers::select('location_country', __('Business country', 'yoast-local-seo') . ':', WPSEO_Local_Frontend::get_country_array());
WPSEO_Local_Admin_Wrappers::textinput('location_phone', __('Business phone', 'yoast-local-seo'));
WPSEO_Local_Admin_Wrappers::textinput('location_phone_2nd', __('2nd Business phone', 'yoast-local-seo'));
WPSEO_Local_Admin_Wrappers::textinput('location_fax', __('Business fax', 'yoast-local-seo'));
WPSEO_Local_Admin_Wrappers::textinput('location_email', __('Business email', 'yoast-local-seo'));
WPSEO_Local_Admin_Wrappers::textinput('location_url', __('URL', 'yoast-local-seo'), '', array('placeholder' => wpseo_xml_sitemaps_base_url('')));
WPSEO_Local_Admin_Wrappers::textinput('location_vat_id', __('VAT ID', 'yoast-local-seo'));
WPSEO_Local_Admin_Wrappers::textinput('location_tax_id', __('Tax ID', 'yoast-local-seo'));
WPSEO_Local_Admin_Wrappers::textinput('location_coc_id', __('Chamber of Commerce ID', 'yoast-local-seo'));
// Calculate lat/long coordinates when address is entered.
if (empty($options['location_coords_lat']) || empty($options['location_coords_long'])) {
$location_coordinates = $wpseo_local_core->get_geo_data(array('_wpseo_business_address' => isset($options['location_address']) ? esc_attr($options['location_address']) : '', '_wpseo_business_city' => isset($options['location_city']) ? esc_attr($options['location_city']) : '', '_wpseo_business_state' => isset($options['location_state']) ? esc_attr($options['location_state']) : '', '_wpseo_business_zipcode' => isset($options['location_zipcode']) ? esc_attr($options['location_zipcode']) : '', '_wpseo_business_country' => isset($options['location_country']) ? esc_attr($options['location_country']) : ''), true);
if (!empty($location_coordinates['coords'])) {
$options['location_coords_lat'] = $location_coordinates['coords']['lat'];
$options['location_coords_long'] = $location_coordinates['coords']['long'];
update_option('wpseo_local', $options);
}
}
echo '<p>' . __('You can enter the lat/long coordinates yourself. If you leave them empty they will be calculated automatically. If you want to re-calculate these fields, please make them blank before saving this location.', 'yoast-local-seo') . '</p>';
WPSEO_Local_Admin_Wrappers::textinput('location_coords_lat', __('Latitude', 'yoast-local-seo'));
WPSEO_Local_Admin_Wrappers::textinput('location_coords_long', __('Longitude', 'yoast-local-seo'));
开发者ID:scottnkerr,项目名称:eeco,代码行数:31,代码来源:local.php
示例3: wpseo_ping_search_engines
/**
* Notify search engines of the updated sitemap.
*
* @param string|null $sitemapurl
*/
function wpseo_ping_search_engines($sitemapurl = null)
{
// Don't ping if blog is not public
if ('0' == get_option('blog_public')) {
return;
}
$options = get_option('wpseo_xml');
if ($sitemapurl == null) {
$sitemapurl = urlencode(wpseo_xml_sitemaps_base_url('sitemap_index.xml'));
}
// Always ping Google and Bing, optionally ping Ask and Yahoo!
wp_remote_get('http://www.google.com/webmasters/tools/ping?sitemap=' . $sitemapurl);
wp_remote_get('http://www.bing.com/ping?sitemap=' . $sitemapurl);
if ($options['xml_ping_yahoo'] === true) {
wp_remote_get('http://search.yahooapis.com/SiteExplorerService/V1/updateNotification?appid=3usdTDLV34HbjQpIBuzMM1UkECFl5KDN7fogidABihmHBfqaebDuZk1vpLDR64I-&url=' . $sitemapurl);
}
if ($options['xml_ping_ask'] === true) {
wp_remote_get('http://submissions.ask.com/ping?sitemap=' . $sitemapurl);
}
}
开发者ID:presteege,项目名称:presteege.fr,代码行数:25,代码来源:wpseo-functions.php
示例4: get_option
exit;
}
global $wpseo_admin_pages;
$wpseo_admin_pages->admin_header(true, WPSEO_Options::get_group_name('wpseo_xml'), 'wpseo_xml');
$options = get_option('wpseo_xml');
$content = $wpseo_admin_pages->checkbox('enablexmlsitemap', __('Check this box to enable XML sitemap functionality.', 'wordpress-seo'), false);
$content .= '<div id="sitemapinfo">';
if (wpseo_is_nginx()) {
$content .= '<div style="margin: 5px 0; padding: 3px 10px; background-color: #ffffe0; border: 1px solid #E6DB55; border-radius: 3px;">';
$content .= '<p>' . __('As you\'re on NGINX, you\'ll need the following rewrites:', 'wordpress-seo') . '</p>';
$content .= '<pre>rewrite ^/sitemap_index\\.xml$ /index.php?sitemap=1 last;
rewrite ^/([^/]+?)-sitemap([0-9]+)?\\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;</pre>';
$content .= '</div>';
}
if ($options['enablexmlsitemap'] === true) {
$content .= '<p>' . sprintf(esc_html__('You can find your XML Sitemap here: %sXML Sitemap%s', 'wordpress-seo'), '<a target="_blank" class="button-secondary" href="' . esc_url(wpseo_xml_sitemaps_base_url('sitemap_index.xml')) . '">', '</a>') . '<br/><br/>' . __('You do <strong>not</strong> need to generate the XML sitemap, nor will it take up time to generate after publishing a post.', 'wordpress-seo') . '</p>';
} else {
$content .= '<p>' . __('Save your settings to activate XML Sitemaps.', 'wordpress-seo') . '</p>';
}
// When we write the help tab for this we should definitely reference this plugin :https://wordpress.org/plugins/edit-author-slug/
$content .= '<h2>' . __('User sitemap', 'wordpress-seo') . '</h2>';
$content .= $wpseo_admin_pages->checkbox('disable_author_sitemap', __('Disable author/user sitemap', 'wordpress-seo'), false);
$content .= '<div id="xml_user_block">';
$content .= '<p><strong>' . __('Exclude users without posts', 'wordpress-seo') . '</strong><br/>';
$content .= $wpseo_admin_pages->checkbox('disable_author_noposts', __('Disable all users with zero posts', 'wordpress-seo'), false);
$roles = wpseo_get_roles();
if (is_array($roles) && $roles !== array()) {
$content .= '<p><strong>' . __('Exclude user roles', 'wordpress-seo') . '</strong><br/>';
$content .= __('Please check the appropriate box below if there\'s a user role that you do <strong>NOT</strong> want to include in your sitemap:', 'wordpress-seo') . '</p>';
foreach ($roles as $role_key => $role_name) {
$content .= $wpseo_admin_pages->checkbox('user_role-' . $role_key . '-not_in_sitemap', $role_name);
开发者ID:CrankMaster336,项目名称:FFW-TR,代码行数:31,代码来源:xml-sitemaps.php
示例5: wpseo_ping_search_engines
/**
* Notify search engines of the updated sitemap.
*
* @param string|null $sitemapurl
*/
function wpseo_ping_search_engines($sitemapurl = null)
{
// Don't ping if blog is not public.
if ('0' == get_option('blog_public')) {
return;
}
if ($sitemapurl == null) {
$sitemapurl = urlencode(wpseo_xml_sitemaps_base_url('sitemap_index.xml'));
}
// Ping Google and Bing.
wp_remote_get('http://www.google.com/webmasters/tools/ping?sitemap=' . $sitemapurl, array('blocking' => false));
wp_remote_get('http://www.bing.com/ping?sitemap=' . $sitemapurl, array('blocking' => false));
}
开发者ID:flasomm,项目名称:Montkailash,代码行数:18,代码来源:wpseo-functions.php
示例6: get_sitemap_name
/**
* Getting the name for the sitemap, if $full_path is true, it will return the full path
*
* @param bool $full_path
*
* @return string mixed
*/
public static function get_sitemap_name($full_path = true)
{
// This filter is documented in classes/class-sitemap.php
$sitemap_name = apply_filters('wpseo_news_sitemap_name', 'news');
// When $full_path is true, it will generate a full path
if ($full_path) {
return wpseo_xml_sitemaps_base_url($sitemap_name . '-sitemap.xml');
}
return $sitemap_name;
}
开发者ID:scottnkerr,项目名称:eeco,代码行数:17,代码来源:wpseo-news.php
示例7: adjacent_rel_links
/**
* Adds 'prev' and 'next' links to archives.
*
* @link http://googlewebmastercentral.blogspot.com/2011/09/pagination-with-relnext-and-relprev.html
* @since 1.0.3
*/
public function adjacent_rel_links()
{
// Don't do this for Genesis, as the way Genesis handles homepage functionality is different and causes issues sometimes.
/**
* Filter 'wpseo_genesis_force_adjacent_rel_home' - Allows devs to allow echoing rel="next" / rel="prev" by WP SEO on Genesis installs
*
* @api bool $unsigned Whether or not to rel=next / rel=prev
*/
if (is_home() && function_exists('genesis') && apply_filters('wpseo_genesis_force_adjacent_rel_home', false) === false) {
return;
}
global $wp_query;
if (!is_singular()) {
$url = $this->canonical(false, true, true);
if (is_string($url) && $url !== '') {
$paged = get_query_var('paged');
if (0 == $paged) {
$paged = 1;
}
if ($paged == 2) {
$this->adjacent_rel_link('prev', $url, $paged - 1, true);
}
// Make sure to use index.php when needed, done after paged == 2 check so the prev links to homepage will not have index.php erroneously.
if (is_front_page()) {
$url = wpseo_xml_sitemaps_base_url('');
}
if ($paged > 2) {
$this->adjacent_rel_link('prev', $url, $paged - 1, true);
}
if ($paged < $wp_query->max_num_pages) {
$this->adjacent_rel_link('next', $url, $paged + 1, true);
}
}
} else {
$numpages = 0;
if (isset($wp_query->post->post_content)) {
$numpages = substr_count($wp_query->post->post_content, '<!--nextpage-->') + 1;
}
if ($numpages > 1) {
$page = get_query_var('page');
if (!$page) {
$page = 1;
}
$url = get_permalink($wp_query->post->ID);
// If the current page is the frontpage, pagination should use /base/
if ($this->is_home_static_page()) {
$usebase = true;
} else {
$usebase = false;
}
if ($page > 1) {
$this->adjacent_rel_link('prev', $url, $page - 1, $usebase, 'single_paged');
}
if ($page < $numpages) {
$this->adjacent_rel_link('next', $url, $page + 1, $usebase, 'single_paged');
}
}
}
}
开发者ID:shellygraham,项目名称:livestock-framing,代码行数:65,代码来源:class-frontend.php
示例8: _e
href="#top#post-types"><?php
_e('Post Types', 'wordpress-seo');
?>
</a>
<a class="nav-tab" id="taxonomies-tab"
href="#top#taxonomies"><?php
_e('Taxonomies', 'wordpress-seo');
?>
</a>
</h2>
<div id="general" class="wpseotab">
<?php
if ($options['enablexmlsitemap'] === true) {
echo '<p>';
printf(esc_html__('You can find your XML Sitemap here: %sXML Sitemap%s', 'wordpress-seo'), '<a target="_blank" class="button-secondary" href="' . esc_url(wpseo_xml_sitemaps_base_url('sitemap_index.xml')) . '">', '</a>');
echo '<br/>';
echo '<br/>';
_e('You do <strong>not</strong> need to generate the XML sitemap, nor will it take up time to generate after publishing a post.', 'wordpress-seo');
echo '</p>';
} else {
echo '<p>', __('Save your settings to activate XML Sitemaps.', 'wordpress-seo'), '</p>';
}
?>
<p>
<strong><?php
_e('Entries per page', 'wordpress-seo');
?>
</strong><br/>
<?php
开发者ID:shellygraham,项目名称:livestock-framing,代码行数:31,代码来源:xml-sitemaps.php
示例9: wpseo_ping_search_engines
/**
* Notify search engines of the updated sitemap.
*
* @param string|null $sitemapurl Optional URL to make the ping for.
*/
function wpseo_ping_search_engines($sitemapurl = null)
{
/**
* Filter: 'wpseo_allow_xml_sitemap_ping' - Check if pinging is not allowed (allowed by default)
*
* @api boolean $allow_ping The boolean that is set to true by default.
*/
if (apply_filters('wpseo_allow_xml_sitemap_ping', true) === false) {
return;
}
// Don't ping if blog is not public.
if ('0' == get_option('blog_public')) {
return;
}
if ($sitemapurl == null) {
$sitemapurl = urlencode(wpseo_xml_sitemaps_base_url('sitemap_index.xml'));
}
// Ping Google and Bing.
wp_remote_get('http://www.google.com/webmasters/tools/ping?sitemap=' . $sitemapurl, array('blocking' => false));
wp_remote_get('http://www.bing.com/ping?sitemap=' . $sitemapurl, array('blocking' => false));
}
开发者ID:healthcommcore,项目名称:osnap,代码行数:26,代码来源:wpseo-functions.php
示例10: hit_sitemap_index
/**
* Make a request for the sitemap index so as to cache it before the arrival of the search engines.
*/
function hit_sitemap_index()
{
$url = wpseo_xml_sitemaps_base_url('sitemap_index.xml');
wp_remote_get($url);
}
开发者ID:CrankMaster336,项目名称:FFW-TR,代码行数:8,代码来源:class-sitemaps.php
示例11: opengraph_location
/**
* Output opengraph location tags.
*
* @link https://developers.facebook.com/docs/reference/opengraph/object-type/business.business
* @link https://developers.facebook.com/docs/reference/opengraph/object-type/restaurant.restaurant
*
* @since 1.0
*/
function opengraph_location()
{
if (is_singular('wpseo_locations') || "on" == WPSEO_Meta::get_value('opengraph-local') && !wpseo_has_multiple_locations()) {
$options = get_option('wpseo_local');
$hide_opening_hours = isset($options['hide_opening_hours']) && $options['hide_opening_hours'] == 'on';
$location_data = wpseo_get_location_details(get_the_ID());
echo '<meta property="place:location:latitude" content="' . $location_data['business_coords_lat'] . '"/>' . "\n";
echo '<meta property="place:location:longitude" content="' . $location_data['business_coords_long'] . '"/>' . "\n";
echo '<meta property="business:contact_data:street_address" content="' . $location_data['business_address'] . '"/>' . "\n";
echo '<meta property="business:contact_data:locality" content="' . $location_data['business_city'] . '"/>' . "\n";
echo '<meta property="business:contact_data:country" content="' . WPSEO_Local_Frontend::get_country($location_data['business_country']) . '"/>' . "\n";
echo '<meta property="business:contact_data:postal_code" content="' . $location_data['business_zipcode'] . '"/>' . "\n";
echo '<meta property="business:contact_data:street_address" content="' . $location_data['business_address'] . '"/>' . "\n";
echo '<meta property="business:contact_data:website" content="' . trailingslashit(wpseo_xml_sitemaps_base_url('')) . '"/>' . "\n";
if (!empty($location_data['business_state'])) {
echo '<meta property="business:contact_data:region" content="' . $location_data['business_state'] . '"/>' . "\n";
}
if (!empty($location_data['business_email'])) {
echo '<meta property="business:contact_data:email" content="' . $location_data['business_email'] . '"/>' . "\n";
}
if (!empty($location_data['business_phone'])) {
echo '<meta property="business:contact_data:phone_number" content="' . $location_data['business_phone'] . '"/>' . "\n";
}
if (!empty($location_data['business_fax'])) {
echo '<meta property="business:contact_data:fax_number" content="' . $location_data['business_fax'] . '"/>' . "\n";
}
// Opening Hours
if (false == $hide_opening_hours) {
$days = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday');
foreach ($days as $day) {
$field_name = '_wpseo_opening_hours_' . $day;
$start = get_post_meta(get_the_ID(), $field_name . '_from', true);
if (!$start || empty($start)) {
continue;
}
$end = get_post_meta(get_the_ID(), $field_name . '_to', true);
if ($start == 'closed') {
$end = 'closed';
}
echo '<meta property="business:hours:day" content="' . $day . '"/>' . "\n";
echo '<meta property="business:hours:start" content="' . $start . '"/>' . "\n";
echo '<meta property="business:hours:end" content="' . $end . '"/>' . "\n";
}
}
}
}
开发者ID:scottnkerr,项目名称:eeco,代码行数:54,代码来源:class-frontend.php
示例12: wpseo_local_show_map
/**
* Maps shortcode handler
*
* @since 0.1
*
* @param array $atts Array of shortcode parameters
*
* @return string
*/
function wpseo_local_show_map($atts)
{
global $map_counter, $wpseo_enqueue_geocoder, $wpseo_map;
$options = get_option('wpseo_local');
$tax_query = array();
// Backwards compatibility for scrollable / zoomable functions
if (is_array($atts) && !array_key_exists('zoomable', $atts)) {
$atts['zoomable'] = isset($atts['scrollable']) ? $atts['scrollable'] : true;
}
$atts = wpseo_check_falses(shortcode_atts(array('id' => '', 'term_id' => '', 'center' => '', 'width' => 400, 'height' => 300, 'zoom' => -1, 'show_route' => true, 'show_state' => true, 'show_country' => false, 'show_url' => false, 'show_email' => false, 'map_style' => isset($options['map_view_style']) ? $options['map_view_style'] : 'ROADMAP', 'scrollable' => true, 'draggable' => true, 'show_route_label' => isset($options['show_route_label']) && !empty($options['show_route_label']) ? $options['show_route_label'] : __('Show route', 'yoast-local-seo'), 'from_sl' => false, 'echo' => false), $atts));
if (!isset($map_counter)) {
$map_counter = 0;
} else {
$map_counter++;
}
$location_array = $lats = $longs = array();
$location_array_str = '';
$default_custom_marker = '';
if (isset($options['custom_marker']) && intval($options['custom_marker'])) {
$default_custom_marker = wp_get_attachment_url($options['custom_marker']);
}
if (!wpseo_has_multiple_locations()) {
$atts['id'] = '';
$location_array[] = array('location_name' => $options['location_name'], 'location_url' => wpseo_xml_sitemaps_base_url(''), 'location_email' => $options['location_email'], 'location_address' => $options['location_address'], 'location_city' => $options['location_city'], 'location_state' => $options['location_state'], 'location_zipcode' => $options['location_zipcode'], 'location_country' => $options['location_country'], 'location_phone' => $options['location_phone'], 'location_phone_2nd' => $options['location_phone_2nd'], 'coordinates_lat' => $options['location_coords_lat'], 'coordinates_long' => $options['location_coords_long'], 'custom_marker' => $default_custom_marker);
} else {
if (get_post_type() == 'wpseo_locations') {
if (($atts['id'] == '' || $atts['id'] == 'current') && !is_post_type_archive()) {
$atts['id'] = get_queried_object_id();
}
if (is_post_type_archive() && ($atts['id'] == '' || $atts['id'] == 'current')) {
return '';
}
if ($atts['id'] == 'all' && $atts['term_id'] != '') {
$tax_query[] = array('taxonomy' => 'wpseo_locations_category', 'field' => 'term_id', 'terms' => $atts['term_id']);
}
} else {
if ($atts['id'] != 'all' && empty($atts['id'])) {
return is_singular('wpseo_locations') ? __('Please provide a post ID when using this shortcode outside a Locations singular page', 'yoast-local-seo') : '';
}
}
$location_ids = explode(',', $atts['id']);
if ($atts['id'] == 'all' || $atts['id'] != 'all' && count($location_ids) > 1) {
$args = array('post_type' => 'wpseo_locations', 'posts_per_page' => $atts['id'] == 'all' ? -1 : count($location_ids), 'fields' => 'ids', 'meta_query' => array(array('key' => '_wpseo_business_address', 'value' => '', 'compare' => '!=')), 'tax_query' => $tax_query);
if (count($location_ids) > 1) {
$args['post__in'] = $location_ids;
}
$location_ids = get_posts($args);
}
foreach ($location_ids as $location_id) {
$custom_marker = wpseo_local_get_custom_marker($location_id, 'wpseo_locations_category');
$tmp_array = array('location_name' => get_the_title($location_id), 'location_url' => get_post_meta($location_id, '_wpseo_business_url', true), 'location_email' => get_post_meta($location_id, '_wpseo_business_email', true), 'location_address' => get_post_meta($location_id, '_wpseo_business_address', true), 'location_city' => get_post_meta($location_id, '_wpseo_business_city', true), 'location_state' => get_post_meta($location_id, '_wpseo_business_state', true), 'location_zipcode' => get_post_meta($location_id, '_wpseo_business_zipcode', true), 'location_country' => get_post_meta($location_id, '_wpseo_business_country', true), 'location_phone' => get_post_meta($location_id, '_wpseo_business_phone', true), 'location_phone_2nd' => get_post_meta($location_id, '_wpseo_business_phone_2nd', true), 'coordinates_lat' => get_post_meta($location_id, '_wpseo_coordinates_lat', true), 'coordinates_long' => get_post_meta($location_id, '_wpseo_coordinates_long', true), 'custom_marker' => $custom_marker != '' ? $custom_marker : $default_custom_marker);
if (empty($tmp_array['location_url'])) {
$tmp_array['location_url'] = get_permalink($location_id);
}
$location_array[] = $tmp_array;
}
}
$noscript_output = '<ul>';
foreach ($location_array as $key => $location) {
if ($location['coordinates_lat'] != '' && $location['coordinates_long'] != '') {
$location_array_str .= "location_data.push( {\n\t\t\t\t'name': '" . wpseo_cleanup_string($location["location_name"]) . "',\n\t\t\t\t'url': '" . wpseo_cleanup_string($location["location_url"]) . "',\n\t\t\t\t'zip_city': '" . wpseo_local_get_address_format(wpseo_cleanup_string($location["location_address"]), false, $location["location_zipcode"], $location["location_city"], $location["location_state"], $atts['show_state'], true) . "',\n\t\t\t\t'country': '" . WPSEO_Local_Frontend::get_country($location['location_country']) . "',\n\t\t\t\t'show_country': " . ($atts['show_country'] ? 'true' : 'false') . ",\n\t\t\t\t'url': '" . esc_url($location['location_url']) . "',\n\t\t\t\t'show_url': " . ($atts['show_url'] ? 'true' : 'false') . ",\n\t\t\t\t'email': '" . $location['location_email'] . "',\n\t\t\t\t'show_email': " . ($atts['show_email'] ? 'true' : 'false') . ",\n\t\t\t\t'phone': '" . wpseo_cleanup_string($location['location_phone']) . "',\n\t\t\t\t'phone_2nd': '" . wpseo_cleanup_string($location['location_phone_2nd']) . "',\n\t\t\t\t'lat': " . wpseo_cleanup_string($location['coordinates_lat']) . ",\n\t\t\t\t'long': " . wpseo_cleanup_string($location['coordinates_long']) . ",\n\t\t\t\t'custom_marker': '" . wpseo_cleanup_string($location['custom_marker']) . "'\n\t\t\t} );\n";
}
$noscript_output .= '<li><a href="' . $location['location_url'] . '">' . $location['location_name'] . '</a></li>';
$noscript_output .= '<li><a href="mailto:' . $location['location_email'] . '">' . $location['location_email'] . '</a></li>';
$full_address = $location['location_address'] . ', ' . $location['location_city'] . (strtolower($location['location_country']) == 'us' ? ', ' . $location['location_state'] : '') . ', ' . $location['location_zipcode'] . ', ' . WPSEO_Local_Frontend::get_country($location['location_country']);
$location_array[$key]['full_address'] = $full_address;
$lats[] = $location['coordinates_lat'];
$longs[] = $location['coordinates_long'];
}
$noscript_output .= '</ul>';
$map = '';
$wpseo_enqueue_geocoder = true;
if (!is_array($lats) || empty($lats) || !is_array($longs) || empty($longs)) {
return;
}
if ($atts['center'] === '') {
$center_lat = min($lats) + (max($lats) - min($lats)) / 2;
$center_long = min($longs) + (max($longs) - min($longs)) / 2;
} else {
$center_lat = get_post_meta($atts['center'], '_wpseo_coordinates_lat', true);
$center_long = get_post_meta($atts['center'], '_wpseo_coordinates_long', true);
}
// Default to zoom 10 if there's only one location as a center + bounds would zoom in far too much.
if (-1 == $atts['zoom'] && 1 === count($location_array)) {
$atts['zoom'] = 10;
}
if ($location_array_str != '') {
$wpseo_map .= '<script type="text/javascript">
var map_' . $map_counter . ';
var directionsDisplay_' . $map_counter . ';
function wpseo_map_init' . ($map_counter != 0 ? '_' . $map_counter : '') . '() {
//.........这里部分代码省略.........
开发者ID:scottnkerr,项目名称:eeco,代码行数:101,代码来源:wpseo-local-functions.php
示例13: get_location_data
/**
* Builds an array based upon the data from the wpseo_locations post type. This data is needed as input for the Geo sitemap & KML API.
*
* @since 1.0
*/
function get_location_data($post_id = null)
{
$locations = array();
$locations["businesses"] = array();
if (wpseo_has_multiple_locations()) {
$args = array('post_type' => 'wpseo_locations', 'posts_per_page' => -1, 'fields' => 'ids');
if (null != $post_id) {
$args['posts_per_page'] = 1;
$args['post__in'] = array($post_id);
}
$posts = get_posts($args);
foreach ($posts as $post_id) {
$business = array("business_name" => get_the_title($post_id), "business_type" => get_post_meta($post_id, '_wpseo_business_type', true), "business_address" => get_post_meta($post_id, '_wpseo_business_address', true), "business_city" => get_post_meta($post_id, '_wpseo_business_city', true), "business_state" => get_post_meta($post_id, '_wpseo_business_state', true), "business_zipcode" => get_post_meta($post_id, '_wpseo_business_zipcode', true), "business_country" => get_post_meta($post_id, '_wpseo_business_country', true), "business_phone" => get_post_meta($post_id, '_wpseo_business_phone', true), "business_phone_2nd" => get_post_meta($post_id, '_wpseo_business_phone_2nd', true), "business_fax" => get_post_meta($post_id, '_wpseo_business_fax', true), "business_email" => get_post_meta($post_id, '_wpseo_business_email', true), "business_url" => get_post_meta($post_id, '_wpseo_business_url', true), "business_description" => wpseo_local_get_excerpt($post_id), "coords" => array('lat' => get_post_meta($post_id, '_wpseo_coordinates_lat', true), 'long' => get_post_meta($post_id, '_wpseo_coordinates_long', true)), "post_id" => $post_id);
$is_postal_address = get_post_meta($post_id, '_wpseo_is_postal_address', true);
$business['is_postal_address'] = $is_postal_address == '1';
if (empty($business['business_url'])) {
$business['business_url'] = get_permalink($post_id);
}
array_push($locations["businesses"], $business);
}
} else {
$options = get_option('wpseo_local');
$business = array("business_name" => $options['location_name'], "business_type" => $options['location_type'], "business_address" => $options['location_address'], "business_city" => $options['location_city'], "business_state" => $options['location_state'], "business_zipcode" => $options['location_zipcode'], "business_country" => $options['location_country'], "business_phone" => $options['location_phone'], "business_phone_2nd" => $options['location_phone_2nd'], "business_fax" => $options['location_fax'], "business_email" => $options['location_email'], "business_description" => get_option("blogname") . ' - ' . get_option("blogdescription"), "business_url" => wpseo_xml_sitemaps_base_url(''), "coords" => array('lat' => $options['location_coords_lat'], 'long' => $options['location_coords_long']));
array_push($locations["businesses"], $business);
}
$base = $GLOBALS['wp_rewrite']->using_index_permalinks() ? 'index.php/' : '';
$locations["business_name"] = get_option("blogname");
$locations["kml_name"] = "Locations for " . $locations["business_name"] . ".";
$locations["kml_url"] = home_url($base . '/locations.kml');
$locations["kml_website"] = wpseo_xml_sitemaps_base_url('');
$locations["author"] = get_option("blogname");
return $locations;
}
开发者ID:scottnkerr,项目名称:eeco,代码行数:38,代码来源:class-core.php
注:本文中的wpseo_xml_sitemaps_base_url函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论