?> prefix="og: http://ogp.me/ns#"> <head> <meta charset="<?php bloginfo('charset'); ?> "/> <?php $pid = get_queried_object_id(); ?> <?php echo restaurante_meta_description(); ?> <?php if (check_if_active_twitter() != false) { echo restaurante_twitter_cards(); } ?> <?php echo restaurante_og_tags(); ?> <link rel="profile" href="http://gmpg.org/xfn/11"/> <link rel="pingback" href="<?php bloginfo('pingback_url'); ?> "/> <?php if (get_theme_mod('restaurante_favicon_upload', '') != '') { ?>
function restaurante_twitter_cards() { $html = ''; $check_twitter = check_if_active_twitter(); if (is_front_page() || is_single() || is_page() && $check_twitter != false) { $pid = get_queried_object_id(); // What the user sees if (get_post_format($pid) == 'video' || get_post_format($pid) == 'audio') { return false; // Is single, or page but it is a video / audio post format. } else { // If is single/page/frontpage BUT not with audio/video post format $featured_image = wp_get_attachment_image_src(get_post_thumbnail_id($pid), ''); $twitter_username = esc_attr(get_theme_mod('restaurante_add_twitter', '')); if ($featured_image != '') { $html = '<meta name="twitter:card" content="summary_large_image"/>' . PHP_EOL; $html .= '<meta name="twitter:site" content="' . $twitter_username . '"/>' . PHP_EOL; $html .= '<meta name="twitter:creator" content="' . $twitter_username . '"/>' . PHP_EOL; $html .= '<meta name="twitter:image" content="' . $featured_image[0] . '"/>' . PHP_EOL; } else { $html .= '<meta name="twitter:card" content="summary">' . PHP_EOL; $html .= '<meta name="twitter:site" content="' . $twitter_username . '"/>' . PHP_EOL; } /** Next Twitter Cards **/ if (is_front_page()) { $html .= '<meta name="twitter:title" content="' . get_bloginfo('name') . '|' . get_bloginfo('description') . '"/>' . PHP_EOL; } else { $html .= '<meta name="twitter:title" content="' . get_the_title() . '"/>' . PHP_EOL; } //Check for Home Meta Description $hmd = get_theme_mod('restaurante_meta_description', ''); $excerpt = ketchup_excerpt_by_id($pid, 35, true); if (is_front_page() && $hmd != '') { $html .= '<meta name="twitter:description" content="' . $hmd . '"/>' . PHP_EOL; } else { $html .= '<meta name="twitter:description" content="' . $excerpt . '"/>' . PHP_EOL; } return $html; } } }