コード例 #1
0
<div class="wrap">
	<h2><?php 
echo vkExUnit_get_name();
?>
 <?php 
_e('CSS Customize', 'vkExUnit');
?>
</h2>
	<div class="fileedit-sub"></div>
	<?php 
echo $data['mess'];
?>
	<p><?php 
_e('You can add custom CSS here.', 'vkExUnit');
?>
</p>
	<form action="<?php 
echo $_SERVER['REQUEST_URI'];
?>
" method="post" id="template">
		<textarea name="bv-css-css" cols="70" rows="10" id="newcontent"><?php 
echo esc_attr($data['customCss']);
?>
</textarea>
		<?php 
wp_nonce_field('biz-vektor-css-submit', 'biz-vektor-css-nonce');
?>
		<p class="submit">
			<input type="submit" name="bv-css-submit" class="button button-primary" value="<?php 
_e('Save CSS', 'vkExUnit');
?>
コード例 #2
0
 public function render_meta_box()
 {
     global $post;
     echo '<input type="hidden" name="_nonce_vkExUnit__custom_field_metaKeyword" id="_nonce_vkExUnit__custom_field_metaKeyword" value="' . wp_create_nonce(plugin_basename(__FILE__)) . '" />';
     echo '<label class="hidden" for="vkExUnit_metaKeyword">' . __('Meta Keywords', 'biz-vektor') . '</label><input type="text" id="vkExUnit_metaKeyword" name="vkExUnit_metaKeyword" size="50" value="' . get_post_meta($post->ID, 'vkExUnit_metaKeyword', true) . '" />';
     echo '<p>' . __('To distinguish between individual keywords, please enter a , delimiter (optional).', 'vkExUnit') . '<br />';
     $theme_option_seo_link = '<a href="' . get_admin_url() . '/admin.php?page=vkExUnit_main_setting#vkExUnit_common_keywords" target="_blank">' . vkExUnit_get_name() . ' ' . __('Main setting', 'vkExUnit') . '</a>';
     echo sprintf(__('* keywords common to the entire site can be set from %s.', 'vkExUnit'), $theme_option_seo_link);
     echo '</p>';
 }
コード例 #3
0
function vkExUnit_print_og()
{
    global $vkExUnit_sns_options;
    $title = '';
    if (is_single() || is_page()) {
        $title = get_post_meta(get_the_id(), 'vkExUnit_sns_title', true);
    }
    if (!$title) {
        $title = vkExUnit_get_wp_head_title();
    }
    //$ogImage = $vkExUnit_sns_options['ogImage'];
    //$fbAppId = $vkExUnit_sns_options['fbAppId'];
    global $wp_query;
    $post = $wp_query->get_queried_object();
    if (is_home() || is_front_page()) {
        $linkUrl = home_url();
    } else {
        if (is_single() || is_page()) {
            $linkUrl = get_permalink();
        } else {
            $linkUrl = get_permalink();
        }
    }
    $vkExUnitOGP = '<!-- [ ' . vkExUnit_get_name() . ' OGP ] -->' . "\n";
    $vkExUnitOGP .= '<meta property="og:site_name" content="' . get_bloginfo('name') . '" />' . "\n";
    $vkExUnitOGP .= '<meta property="og:url" content="' . $linkUrl . '" />' . "\n";
    $vkExUnitOGP .= '<meta property="og:title" content="' . $title . '" />' . "\n";
    $vkExUnitOGP .= '<meta property="og:description" content="' . vkExUnit_get_pageDescription() . '" />' . "\n";
    if (isset($vkExUnit_sns_options['fbAppId']) && $vkExUnit_sns_options['fbAppId']) {
        $vkExUnitOGP = $vkExUnitOGP . '<meta property="fb:app_id" content="' . $vkExUnit_sns_options['fbAppId'] . '" />' . "\n";
    }
    if (is_front_page() || is_home()) {
        $vkExUnitOGP .= '<meta property="og:type" content="website" />' . "\n";
        if (isset($vkExUnit_sns_options['ogImage']) && $vkExUnit_sns_options['ogImage']) {
            $vkExUnitOGP .= '<meta property="og:image" content="' . $vkExUnit_sns_options['ogImage'] . '" />' . "\n";
        }
    } else {
        if (is_category() || is_archive()) {
            $vkExUnitOGP .= '<meta property="og:type" content="article" />' . "\n";
            if (isset($vkExUnit_sns_options['ogImage']) && $vkExUnit_sns_options['ogImage']) {
                $vkExUnitOGP .= '<meta property="og:image" content="' . $vkExUnit_sns_options['ogImage'] . '" />' . "\n";
            }
        } else {
            if (is_page() || is_single()) {
                $vkExUnitOGP .= '<meta property="og:type" content="article" />' . "\n";
                // image
                if (has_post_thumbnail()) {
                    $image_id = get_post_thumbnail_id();
                    $image_url = wp_get_attachment_image_src($image_id, 'large', true);
                    $vkExUnitOGP .= '<meta property="og:image" content="' . $image_url[0] . '" />' . "\n";
                } else {
                    if (isset($vkExUnit_sns_options['ogImage']) && $vkExUnit_sns_options['ogImage']) {
                        $vkExUnitOGP .= '<meta property="og:image" content="' . $vkExUnit_sns_options['ogImage'] . '" />' . "\n";
                    }
                }
            } else {
                $vkExUnitOGP .= '<meta property="og:type" content="article" />' . "\n";
                if (isset($vkExUnit_sns_options['ogImage']) && $vkExUnit_sns_options['ogImage']) {
                    $vkExUnitOGP .= '<meta property="og:image" content="' . $vkExUnit_sns_options['ogImage'] . '" />' . "\n";
                }
            }
        }
    }
    $vkExUnitOGP .= '<!-- [ / ' . vkExUnit_get_name() . ' OGP ] -->' . "\n";
    if (isset($vkExUnit_sns_options['ogTagDisplay']) && $vkExUnit_sns_options['ogTagDisplay'] != true) {
        $vkExUnitOGP = '';
    }
    $vkExUnitOGP = apply_filters('vkExUnitOGPCustom', $vkExUnitOGP);
    echo $vkExUnitOGP;
}
コード例 #4
0
function vkExUnit_add_twitterCard()
{
    global $vkExUnit_sns_options;
    // url
    $linkUrl = is_front_page() ? home_url() : get_permalink();
    // image
    if ((is_single() || is_page()) && has_post_thumbnail()) {
        $image_id = get_post_thumbnail_id();
        $image_url = wp_get_attachment_image_src($image_id, 'large', true);
        $card_image_url = $image_url[0];
    } else {
        $card_image_url = isset($vkExUnit_sns_options['ogImage']) ? $vkExUnit_sns_options['ogImage'] : '';
    }
    $title = '';
    if (is_single() || is_page()) {
        $title = get_post_meta(get_the_id(), 'vkExUnit_sns_title', true);
    }
    if (!$title) {
        $title = vkExUnit_get_wp_head_title();
    }
    // domain
    preg_match('/https?:\\/\\/(.+?)\\//i', admin_url(), $match);
    // image size
    if (isset($vkExUnit_sns_options['twitterId']) && $vkExUnit_sns_options['twitterId'] && $card_image_url) {
        ?>
<!-- [ <?php 
        echo vkExUnit_get_name();
        ?>
 twitter card ] -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:description" content="<?php 
        echo vkExUnit_get_pageDescription();
        ?>
">
<meta name="twitter:title" content="<?php 
        echo $title;
        ?>
">
<meta name="twitter:url" content="<?php 
        echo $linkUrl;
        ?>
">
<meta name="twitter:image" content="<?php 
        echo esc_url($card_image_url);
        ?>
">
<meta name="twitter:domain" content="<?php 
        echo $match[1];
        ?>
">
<meta name="twitter:site" content="@<?php 
        echo $vkExUnit_sns_options['twitterId'];
        ?>
">
<!-- [ / <?php 
        echo vkExUnit_get_name();
        ?>
 twitter card ] -->
	<?php 
    }
}