Skip to content

Instantly share code, notes, and snippets.

<label class="radio">
<input name="stores_charge" class="radio_input" type="radio" checked>
<span class="radio_text">全て</span>
</label>
// 入力がない場合の分岐
<?php if(get_post_meta($post->ID,'text5',true)): ?>
<h3>タイトルが入ります</h3>
<?php echo $cfs->get('text5'); ?>
<?php endif; ?>
// チェックボックスを使った分岐
<?php if ( get_post_meta($post->ID,'box',TRUE) ): ?>
チェックボックスにチェックをいれるとこの文章が表示されます。
<?php endif; ?>
<h1 class="subtitle subtitle3">hoge</h1>
$(function() {
let tabs = $(".tab"); // tabのクラスを全て取得し、変数tabsに配列で定義
$(".tab").on("click", function() { // tabをクリックしたらイベント発火
$(".active").removeClass("active"); // activeクラスを消す
$(this).addClass("active"); // クリックした箇所にactiveクラスを追加
const index = tabs.index(this); // クリックした箇所がタブの何番目か判定し、定数indexとして定義
$(".content").removeClass("show").eq(index).addClass("show"); // showクラスを消して、contentクラスのindex番目にshowクラスを追加
})
})
// ページ内リンク時スムーズにスクロールします
$(function () {
// #で始まるアンカーをクリックした場合に処理
$('a[href^="#"]'+ 'a,area').click(function () {
var speed = 400;
var href = $(this).attr("href");
var target = $(href == "#" || href == "" ? 'html' : href);
var position = target.offset().top;
$('body,html').animate({ scrollTop: position }, speed, 'swing');
return false;
.hoge {
background: linear-gradient(to bottom, transparent 0%, transparent 70%, #fff 100%), url(./images/bg.jpg);
background-repeat: no-repeat;
background-position: center top;
background-size: cover;
}
@media(min-width: 769px){
a[href^="tel:"]{
pointer-events: none;
}
}
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::
** エディタのビジュアル・テキスト切替でコード消滅を防止
::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
function my_tiny_mce_before_init( $init_array ) {
$init_array['valid_elements'] = '*[*]';
$init_array['extended_valid_elements'] = '*[*]';
return $init_array;
}
add_filter( 'tiny_mce_before_init' , 'my_tiny_mce_before_init' );
// ログイン画面のロゴ変更
function login_logo() {
echo '<style type="text/css">.login h1 a {background-image: url('.get_bloginfo('template_directory').'/images/login-logo.png);width:●●px;height:●●px;background-size:●●px ●●px;}</style>';
}
add_action('login_head', 'login_logo');
// ログイン画面のロゴURL
function custom_login_logo_url() {
return get_bloginfo( 'url' );
}
// デフォルトテーマのCSSを読み込まないようにします
add_action('wp_enqueue_scripts', function () {
$styles = wp_styles();
$styles->add_data('twentytwenty-style', 'after', array());
}, 20);