function deseret_connect_head()
{
    if (!is_singular()) {
        return;
    }
    $postId = get_the_id();
    $canonical = get_post_meta($postId, '_dc_syn_canonical', true);
    $standout = get_post_meta($postId, '_dc_syn_standout', true);
    $syndication_source = get_post_meta($postId, '_dc_syn_syndication_source', true);
    $description = get_post_meta($postId, '_dc_syn_description', true);
    $authors = get_post_meta($postId, '_dc_syn_authors', true);
    if ($canonical) {
        echo $canonical . "\n";
    } else {
        rel_canonical();
    }
    if ($standout) {
        echo $standout . "\n";
    }
    if ($description) {
        echo $description . "\n";
    }
    if ($authors) {
        echo $authors . "\n";
    }
}
 function wds_canonical()
 {
     global $wds_options;
     global $wp_query, $paged;
     if (function_exists('bp_is_blog_page') && !(bp_is_blog_page() || is_404())) {
         return false;
     }
     // Set decent canonicals for homepage, singulars and taxonomy pages
     if (wds_get_value('canonical') && wds_get_value('canonical') != '') {
         echo "\t" . '<link rel="canonical" href="' . wds_get_value('canonical') . '" />' . "\n";
     } else {
         if (is_singular()) {
             echo "\t";
             rel_canonical();
         } else {
             $canonical = '';
             if (is_front_page()) {
                 $canonical = trailingslashit(get_bloginfo('url'));
             } else {
                 if (is_tax() || is_tag() || is_category()) {
                     $term = $wp_query->get_queried_object();
                     $canonical = wds_get_term_meta($term, $term->taxonomy, 'wds_canonical');
                     $canonical = $canonical ? $canonical : get_term_link($term, $term->taxonomy);
                 } else {
                     if (is_date()) {
                         $requested_year = get_query_var('year');
                         $requested_month = get_query_var('monthnum');
                         $date_callback = !empty($requested_year) && empty($requested_month) ? 'get_year_link' : 'get_month_link';
                         $canonical = $date_callback($requested_year, $requested_month);
                     }
                 }
             }
             //only show id not error object
             if ($canonical && !is_wp_error($canonical)) {
                 if ($paged && !is_wp_error($paged)) {
                     $canonical .= trailingslashit('page/' . $paged);
                 }
                 echo "\t" . '<link rel="canonical" href="' . $canonical . '" />' . "\n";
             }
         }
     }
 }
Beispiel #3
0
/**
 * Make sure the canonical URL of a single product page is correct.
 *
 * When wpsc_filter_product_permalink() is attached to 'post_type_link', the side effect is that
 * canonical URL is not canonical any more because 'wpsc_product_category' query var is taken into
 * account.
 *
 * This function temporarily removes the original wpsc_filter_product_permalink() function from 'post_type_link'
 * hook, and replaces it with wpsc_filter_product_permalink_canonical().
 *
 * @since 4.0
 * @uses  add_filter() Restores wpsc_filter_product_permalink() to 'post_type_link' filter.
 * @uses  add_filter() Temporarily attaches wpsc_filter_product_permalink_canonical() to 'post_type_link' filter.
 * @uses  remove_filter() Removes wpsc_filter_product_permalink_canonical() from 'post_type_link' filter.
 * @uses  remove_filter() Temporarily removes wpsc_filter_product_permalink() from 'post_type_link' filter.
 */
function wpsc_action_rel_canonical()
{
    remove_filter('post_type_link', 'wpsc_filter_product_permalink', 10, 4);
    add_filter('post_type_link', 'wpsc_filter_product_permalink_canonical', 10, 4);
    rel_canonical();
    remove_filter('post_type_link', 'wpsc_filter_product_permalink_canonical', 10, 4);
    add_filter('post_type_link', 'wpsc_filter_product_permalink', 10, 4);
}
Beispiel #4
0
 public function head_data()
 {
     $object_id = (int) $this->itemId;
     // meta vars
     $url = get_the_permalink($object_id);
     $seo = tr_posts_field('seo.meta', $object_id);
     $desc = esc_attr($seo['description']);
     $og_title = esc_attr($seo['og_title']);
     $og_desc = esc_attr($seo['og_desc']);
     $img = esc_attr($seo['meta_img']);
     $canon = esc_attr($seo['canonical']);
     $robots['index'] = esc_attr($seo['index']);
     $robots['follow'] = esc_attr($seo['follow']);
     $tw['card'] = esc_attr($seo['tw_card']);
     $tw['site'] = esc_attr($seo['tw_site']);
     $tw['image'] = esc_attr($seo['tw_img']);
     $tw['title'] = esc_attr($seo['tw_title']);
     $tw['desc'] = esc_attr($seo['tw_desc']);
     // Extra
     if (!empty($canon)) {
         echo "<link rel=\"canonical\" href=\"{$canon}\" />";
     } else {
         rel_canonical();
     }
     // Robots
     if (!empty($robots)) {
         $robot_data = '';
         foreach ($robots as $value) {
             if (!empty($value) && $value != 'none') {
                 $robot_data .= $value . ', ';
             }
         }
         $robot_data = mb_substr($robot_data, 0, -2);
         if (!empty($robot_data)) {
             echo "<meta name=\"robots\" content=\"{$robot_data}\" />";
         }
     }
     // OG
     if (!empty($og_title)) {
         echo "<meta property=\"og:title\" content=\"{$og_title}\" />";
     }
     if (!empty($og_desc)) {
         echo "<meta property=\"og:description\" content=\"{$og_desc}\" />";
     }
     if (!empty($img)) {
         $src = wp_get_attachment_image_src($img, 'full');
         $src = $src[0];
         $prefix = 'https';
         if (mb_substr($src, 0, mb_strlen($prefix)) == $prefix) {
             $src = mb_substr($src, mb_strlen($prefix));
             $src = 'http' . $src;
         }
         echo "<meta property=\"og:image\" content=\"{$src}\" />";
     }
     if (!empty($url)) {
         echo "<meta property=\"og:url\" content=\"{$url}\" />";
     }
     // Twitter
     if (!empty($tw['card'])) {
         echo "<meta name=\"twitter:card\" content=\"{$tw['card']}\" />";
     }
     if (!empty($tw['site'])) {
         echo "<meta name=\"twitter:site\" content=\"{$tw['site']}\" />";
     }
     if (!empty($tw['image'])) {
         $src = wp_get_attachment_image_src($tw['image'], 'full');
         $src = $src[0];
         echo "<meta name=\"twitter:image\" content=\"{$src}\" />";
     }
     if (!empty($tw['title'])) {
         echo "<meta name=\"twitter:title\" content=\"{$tw['title']}\" />";
     }
     if (!empty($tw['desc'])) {
         echo "<meta name=\"twitter:desciption\" content=\"{$tw['desc']}\" />";
     }
     // Basic
     if (!empty($desc)) {
         echo "<meta name=\"description\" content=\"{$desc}\" />";
     }
 }
Beispiel #5
0
/**
 * Set canonical URL to the Ad URL when in viewing on of AWPCP Ads.
 *
 * @since unknown
 * @since 3.2.1	logic moved to awpcp_rel_canonical_url()
 */
function awpcp_rel_canonical()
{
    $url = awpcp_rel_canonical_url();
    if ($url) {
        echo "<link rel='canonical' href='{$url}' />\n";
    } else {
        rel_canonical();
    }
}
 public function _meta_rel_canonical()
 {
     $action = $this->controller->get_current_action();
     if (!$action) {
         return rel_canonical();
     }
     if (in_array($action, array('editlisting', 'submitlisting', 'sendcontactmessage', 'deletelisting', 'upgradetostickylisting', 'renewlisting'))) {
         return;
     }
     if ($action == 'showlisting') {
         $listing_id = get_query_var('listing') ? wpbdp_get_post_by_slug(get_query_var('listing'))->ID : wpbdp_getv($_GET, 'id', get_query_var('id'));
         $link = get_permalink($listing_id);
     } else {
         $link = $_SERVER['REQUEST_URI'];
     }
     echo sprintf('<link rel="canonical" href="%s" />', esc_url($link));
 }
    echo esc_attr($slide_title);
    ?>
" />
<?php 
}
?>

	<?php 
wp_head();
?>

	<?php 
if (!has_action('wp_head', 'rel_canonical')) {
    ?>
	<?php 
    rel_canonical();
    ?>
	<?php 
}
?>

	<!--[if IE 8]>
	<style type="text/css">
		.slide {
			display: table;
			height: 100%;
		}
	</style>
	<![endif]-->
</head>
<body class="home" style="background-color:<?php 
Beispiel #8
-1
 /**
  * Remove self-closing tags.
  */
 public function rel_canonical()
 {
     ob_start(function ($buffer) {
         return str_replace(' />', '>', $buffer);
     });
     rel_canonical();
     ob_end_flush();
 }