<?php
$count = count(get_field(‘fieldname’));
?>
<?php
$count = count(get_field(‘fieldname’));
?>
CSS 2025.7.17
.scroll {
overflow: auto;
&::-webkit-scrollbar {
width: 3px;
}
&::-webkit-scrollbar-track {
background-color: #f0f0f0;
}
&::-webkit-scrollbar-thumb {
background-color: #999;
border-radius: 0;
}
}
WordPress 2025.7.10
WP_Queryでカテゴリ絞り込みを使うと効かない模様
以下のように「’ignore_sticky_posts’ => false」を付けるとうまくいきます。
$args = array(
'post_type' => 'post', // 投稿タイプ
'posts_per_page' => 10, // 表示件数
'ignore_sticky_posts' => false, // 先頭固定表示を有効にする
);
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) {
while ( $the_query->have_posts() ) {
$the_query->the_post();
?>
<--- 記事の表示 -->
<?php
}
wp_reset_postdata();
} else {
// 記事が見つからない場合の処理
}
.slick-slider div {
transition: none;
}
.slick-slide {
-webkit-backface-visibility: hidden;
-webkit-transform-style: preserve-3d;
}
CSS 2025.5.23
background: linear-gradient(transparent 60%, #63A0DA 0%);
display: inline;
padding: 5px;
box-decoration-break: clone;
-webkit-box-decoration-break: clone;
jQuery 2025.4.2
.slick-slider {
visibility: hidden;
}
$(document).ready(function() {
$('.slider').on('init', function(event, slick) {
$('.slick-slider').css('visibility', 'visible');
}).slick({
autoplay: true,
});
});
<section class="scroll">
<div class="first">
テキスト1 テキスト2 テキスト3 テキスト4 テキスト5
</div>
<div class="last">
テキスト1 テキスト2 テキスト3 テキスト4 テキスト5
</div>
</section>
.scroll {
display: flex;
overflow: hidden;
}
.scroll .first,
.scroll .last {
flex-shrink: 0;
width: auto;
height: auto;
display: inline-block;
text-wrap: nowrap;
white-space: nowrap;
}
.scroll .first {
animation: ani-first 10s infinite linear 0.1s both;
}
.scroll .last {
animation: ani-last 10s infinite linear 0.1s both;
}
@keyframes ani-first {
0% {
transform: translateX(0%);
}
100% {
transform: translateX(-100%);
}
}
@keyframes ani-last {
0% {
transform: translateX(0%);
}
100% {
transform: translateX(-100%);
}
}
jQuery 2024.3.27
遷移先ページへ以下を記述する
$(window).load(function () {
var lochref = window.location.href;
if (lochref.indexOf("#") > -1) {
var anchor = lochref.slice(lochref.indexOf("#"));
window.setTimeout(function () {
$("body, html").animate(
{
scrollTop: $(anchor).offset().top,
},
1
);
}, 1);
}
});
WordPress 2024.3.19
これまでは、
<?php the_field('field_name'); ?>
これからは
<?php echo get_field('field_name'); ?>
jQuery 2024.3.13
/* ===============================================
# faq
=============================================== */
jQuery(function ($) {
$(".question").on("click", function () {
/*クリックでコンテンツを開閉*/
$(this).next().slideToggle(200);
/*矢印の向きを変更*/
$(this).toggleClass("open", 200);
});
});
/* ===============================================
# faq 排他処理
=============================================== */
$(function() {
$('.question').click(function() {
$(this).toggleClass('open');
$(this).next().slideToggle();
$('.question').not($(this)).next().slideUp();
$('.question').not($(this)).removeClass('open');
});
});