よくある質問

/* ===============================================
  # 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');
		});
	});

acfでiframeを使う方法

functions.phpに以下を追加する

add_filter( 'wp_kses_allowed_html', 'acf_add_allowed_iframe_tag', 10, 2 );
  function acf_add_allowed_iframe_tag( $tags, $context ) {
  if ( $context === 'acf' ) {
  $tags['iframe'] = array(
  'src' => true,
  'height' => true,
  'width' => true,
  'frameborder' => true,
  'allowfullscreen' => true,
  );
  }
  
  return $tags;
  }

MW WP FORM datepickerが動かない

<?php wp_head(); ?> 下に入れる

	&lt;link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">
	&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js">&lt;/script>
	&lt;script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js">&lt;/script>

100vhスクロールしたらclass付与

$(window).scroll(function() {
        var height = $(window).height();
        if ($(window).scrollTop() > height) {
            $('header').addClass('is-show');
        } else {
            $('header').removeClass('is-show');
        }
    });

MW WP FORM サンクスページ

thanksページを作りたくないのでパラメータを付ける

functions.php

function my_mwform_after_send( $Data ) {
    if ( $Data->get_form_key() === 'mw-wp-form-xxx' ) {
      $id = $Data->get( 'id' ); $url = get_permalink($id);
      wp_redirect($url.'?q=thanks');
      exit;
    }
  }
  add_action( 'mwform_after_send_mw-wp-form-xxx', 'my_mwform_after_send' );

timthumb

functions.php

/* ===============================================
# timthumb
=============================================== */
define('THEME_DIR', get_template_directory_uri());
/* Timthumb CropCropimg */
function thumbCrop($img='', $w=false, $h=false , $zc=1, $a=false, $cc=false ){
    if($h)
        $h = "&amp;h=$h";
    else
        $h = "";
    if($w)
        $w = "&amp;w=$w";
    else
        $w = "";
	if($a)
        $a = "&amp;a=$a";
    else
        $a = "";
	if($cc)
        $cc = "&amp;cc=$cc";
    else
        $cc = "";
    $img = str_replace(get_bloginfo('url'), '', $img);
     $image_url = str_replace("http://","http://",THEME_DIR) . "/timthumb/timthumb.php?src=" . $img . $h . $w. "&amp;zc=".$zc .$a .$cc;
    return $image_url;
}

HTML

<?php
							$image = get_field('image');
							$size = 'large'; // (thumbnail, medium, large, full or custom size)
							if ($image) {
								$image_url1 = wp_get_attachment_image_url($image, $size);
								$image_url2 =  get_template_directory_uri() . "/timthumb/timthumb.php?src=" . $image_url1 . '&amp;h=564' . '&amp;w=752';
							?>
								<img src="<?php echo $image_url2; ?>">
							<?php
							} else {
							?>
								<img src="https://placehold.jp/eeeeee/ffffff/752x564.png?text=No%20photo" alt="">
							<?php
							}
?>

Warning: Undefined variable $additional_loop in /home/xs271582/amezo.net/public_html/wp-content/themes/amezo/index.php on line 47

Warning: Attempt to read property "max_num_pages" on null in /home/xs271582/amezo.net/public_html/wp-content/themes/amezo/index.php on line 47