Skip to content

Instantly share code, notes, and snippets.

@yukari-n
Last active January 6, 2017 01:28
Show Gist options
  • Select an option

  • Save yukari-n/1fd1d0289eb6392b78139897318e9d72 to your computer and use it in GitHub Desktop.

Select an option

Save yukari-n/1fd1d0289eb6392b78139897318e9d72 to your computer and use it in GitHub Desktop.
サイトのコード(一部)。_は/に読み替え。テストサイトは間に合いませんでした。稼働しているサイトは秘密。
<?php
// CSS登録
function register_style(){
wp_register_style('bootstrap','http://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/css/bootstrap.min.css');
wp_register_style('cc','/css/cc.css');
wp_register_style('sawarabi','https://fonts.googleapis.com/earlyaccess/sawarabimincho.css');
wp_register_style('ccommons','https://cdn.jsdelivr.net/cc-icons/1.2.1/css/cc-icons.min.css'); //'https://cdnjs.cloudflare.com/ajax/libs/cc-icons/1.2.1/css/cc-icons.min.css'
}
function add_stylesheet(){
register_style();
wp_enqueue_style('bootstrap');
wp_enqueue_style('sawarabi');
if(is_singular('post')){wp_enqueue_style('ccommons');}
wp_enqueue_style('cc'); //常に最後に
}
add_action('wp_print_styles','add_stylesheet');
//プラグインCSS排除
function my_deregister_styles(){
wp_deregister_style('pz-linkcard');
wp_deregister_style('math-captcha-frontend');
wp_deregister_style('peg-display.css');
if(!is_page()){wp_deregister_style('contact-form-7');}
if(!is_singular()){wp_deregister_style('toc-screen');}
}
add_action( 'wp_print_styles', 'my_deregister_styles', 100 );
<?php
function jquery_man() {
//register_script();
wp_deregister_script('jquery');
wp_enqueue_script('prefixfree','https://cdn.jsdelivr.net/prefixfree/1.0.7/prefixfree.min.js');//header
wp_enqueue_script('mjquery','http://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.1.1.min.js','','',true);
wp_enqueue_script('mbootstrap','http://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/bootstrap.min.js','','',true);
if(is_page('1441')){wpcf7_enqueue_scripts();}
if(!is_page()){
wp_deregister_script('jquery-form'); //contact-form-7
wp_deregister_script('contact-form-7');
}
if(!is_singular()){wp_deregister_script('toc-front');}
//下のは実装したい
//wp_enqueue_script('contextmenu','https://cdnjs.cloudflare.com/ajax/libs/bootstrap-contextmenu/0.3.4/bootstrap-contextmenu.min.js','','',true);
}
add_action('wp_enqueue_scripts', 'jquery_man');
?>
<?php
function schema_markup($schema,$canonical,$ttitle,$s_schema){
return '<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "'.$schema.'",
"url": "'.$canonical.'",
"name": "'.$ttitle.'",
"publisher":{
"@context": "http://schema.org",
"@type": "Person",
"name": "'.get_the_author_meta('display_name',WP_ADMIN_ID).'",
"memberOf":{
"@context": "http://schema.org",
"@type": "MusicGroup",
"name": "'.get_bloginfo('name').'"
}
}'.$s_schema.'
}
</script>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment