Skip to content

Instantly share code, notes, and snippets.

@alt-karate
alt-karate / index.php
Created April 10, 2019 10:43
test.php
<div class="menu__tabscover" id="Menu">
<ul class="menu__tab">
<li><a href="#menuA" class="active">メニューA</a></li>
<li><a href="#menuB">メニューB</a></li>
<li><a href="#menuC">メニューC</a></li>
</ul>
<section id="menuA" class="menuA_cont tabcont--hide">
<?php $fieldloops = $cfs->get('menuAloop');
foreach ($fieldloops as $fieldloop) { ?>
<div><?php echo $fieldloop['menuA']; ?></div>
@alt-karate
alt-karate / style.css
Created April 10, 2019 10:45
test.css
.tabcont--hide {
display: none;
}
@alt-karate
alt-karate / common.js
Created April 10, 2019 10:46
test.js
$(function() {
if ($('#menu')[0]) {
var $tabcontAry = [$('#menuA'), $('#menuB'), $('#menuC')];
$('.menu__tab a').off().on('click', function() {
if (!$(this).hasClass('active')) {
$('.menu__tab a').removeClass('active');
$(this).addClass('active');
var clickdNum = $('.menu__tab a').index($(this));
for (var i = 0; i < $tabcontAry.length; i++) {
$tabcontAry[i].hide();
/**
* スラッグの日本語禁止します
*/
function auto_post_slug( $slug, $post_ID, $post_status, $post_type ) {
if ( preg_match( '/(%[0-9a-f]{2})+/', $slug ) ) {
$slug = utf8_uri_encode( $post_type ) . '-' . $post_ID;
}
return $slug;
}
add_filter( 'wp_unique_post_slug', 'auto_post_slug', 10, 4 );
add_filter( 'wp_calculate_image_srcset', '__return_false' );
<?php
wp_deregister_script( 'jquery' );
wp_enqueue_script('jquery','/js/jquery.js');
wp_head();
?>
/*-------------------------------------------*/
/* ヘッダー画像の推奨サイズを変更します
/*-------------------------------------------*/
add_filter( 'twentyten_header_image_width', create_function( '' , 'return 1050;' ) );
add_filter( 'twentyten_header_image_height', create_function( '' , 'return 430;' ) );
/*
* 投稿にアーカイブ(投稿一覧)を持たせるようにします。
* ※ 記載後にパーマリンク設定で「変更を保存」してください。
*/
function post_has_archive( $args, $post_type ) {
if ( 'post' == $post_type ) {
$args['rewrite'] = true;
$args['has_archive'] = 'newsrelease'; // ページ名
}
return $args;
<?php
if($wp_query->queried_object->parent == 0) :
$term_id = $wp_query->queried_object->term_id;
$taxonomy_name = $wp_query->queried_object->taxonomy;
$termchildren = get_term_children( $term_id, $taxonomy_name );
foreach ( $termchildren as $child ) :
$taxs[] = $child;
endforeach;
<?php if ( has_term('カスタム分類名', 'カスタム投稿タイプ名') ) { ?>
AAAAAA
<?php } elseif ( has_term('カスタム分類名', 'カスタム投稿タイプ名') ) { ?>
BBBBBB
<?php } ?>