パンくずをカスタム投稿タイプごとに親を設定できるようにした GPTサポートあり

<div class="pan_wrap">

    <div class="pan_wrap_width max1500">
        
        <div id="site_navi">
 <div>


 <?php if(is_tax())://1階層 ?>



                   
 <a href="/" >HOME</a>  &gt; 

  <?php  ///指定URL (設定ポストタイプ) か  アーカイブ か リンクなし か 
$taxonomy = get_queried_object() -> taxonomy; //tax_name取得
///echo $taxonomy; //qa_cate

$tax_obj  = get_taxonomy( $taxonomy ); //カスタムポストタイプを取得

    // echo "<pre>";
    // print_r($tax_obj);
    // echo "</pre>";
        //配列

if ( $tax_obj && ! empty( $tax_obj->object_type ) ) { //カスタムポストタイプがあるなら わまして、$post_typeに収納
  foreach ( $tax_obj->object_type as $post_type ) { //ここで$post_type生成

    $pt_obj = get_post_type_object( $post_type );//指定したポストタイプの「設定情報(オブジェクト)」を取得する関数
    if ( ! $pt_obj ) continue;//空ならスキップ

$label = $pt_obj->labels->name;//ラベル取得
$url   = get_post_type_archive_link( $post_type );// URL取得 has_archive これない場合

//ここまで準備??


//ここで設定の親URLを照らし合わせる
///カスタム投稿タイプ 
$breadcrumb_settings =  get_field("breadcrumb_settings",$site_con_id);

if($breadcrumb_settings)://////////////////////////////////////////url設定があれば

        $attaka = '0';//ループで回ったかチェック 定義

        foreach ( $breadcrumb_settings as $breadcrumb_setting ) {
    if ( $breadcrumb_setting['post_type'] === $post_type ) {
        // ここで分岐
                $attaka++;//回ればnullでなくなる

                $url = $breadcrumb_setting['parent_url'];

      echo '<a href="' . esc_url($url ) . '">';
      echo esc_html( $label );
      echo '</a>';
      echo ' &gt; ';

    }
}

if($attaka)://まわったらここでおわり

else://まわってないなら

    if ( $url ) : //アーカイブあり
      echo '<a href="' . esc_url( $url ) . '">';
      echo esc_html( $label );
      echo '</a>';
      echo ' &gt; ';

    else://アーカイブなし

        echo esc_html( $label );
         echo ' &gt; ';

      endif;//end //アーカイブあり

    endif;//endまわってないなら

     endif;//end    url設定があれば

  }}



?>

 <?php single_term_title( ); //アーカイブターム名を出力
?></div>



<?php elseif(is_category()): //1階層?>

                <a href="/" >HOME</a>  &gt; <?php single_term_title( ); //アーカイブターム名を出力
?></div>           
        
        
<?php else: ?>       
            
<div>
 <a href="/" >HOME</a> <?php if(is_singular('newlybuilt')):?> &gt; <a href="/<?php echo $jisseki_name ?>/"><?php echo $jisseki_name ?></a><?php endif; ?> &gt; <?php $title_name = get_the_title(); echo $title_name ; ?></div>
            
   <?php endif; ?>         
            

 
   

</div>
        </div>
</div>

https://chatgpt.com/share/696600a5-2e54-8010-9e95-b7da048328f0

https://chatgpt.com/share/696600e6-c92c-8010-8fb8-77994522f091

 

0_control_cutom_post_type

os アップデート用 ソフトチェック 代替えソフト

koala ▶ prepros (テーマフォルダを全部入れれば同じような動作)

デフォルトのセッティングにて、自動コンパイルをNG化 必要な2ファイルのみ自動コンパイル

新しいプロジェクトを入れる場合は、add projectを押してフォルダを投げないと、

コンパイル先の変更時、同じフォルダ内の子テーマにすぐならない

 

 

WPS Office ▶LibreOffice

 

スライダーを管理画面より選ぶために

■ スライダーは 完成図を親テーマに入れて、もっとフォルダ名ですぐどれかわかるようにする
親テーマはあくまで保管庫として、
実際は子テーマに入れて改造してはどうか?

どうせ、全く同じでは対応できないため
lessは必ず変更になる。
スタート地点で作ったやつからスタートすればカスタムは早い

ただ、今あるスライダーのサンプルをすっと見たいが、今はlessが1つのインポートで チェンジすることで見れる様になっている
これをどうするか?

スライダーごとに、大枠で囲って クラス名を変えて、 less自体も 大枠で囲って、同じクラスでも、他のクラスが影響されないようにするか?





swiper 多分full 会社バナー用とかはいってるな
less を css化して、分岐で選択させる
改造する際は、チルド 同じフォルダのphp cssを改造する

結局

色々回って回ってやった事。

less を vscodeでコンパイルする

Easy LESS をインストール

デフォルト設定でコンパイルを辞める

settings.json

//less の自動コンパイル 止める  Easy LESS
"less.compile": {
  "out": false
},

VScodeでsettings.jsonが見つからない場合参考記事

https://qiita.com/magatama/items/17311a325a0586d4cba2

 

コンパイルさせるlessにて

// out: true 
// Easy LESS //一行目にいる
// このlessでコンパイルするのだから、完結する必要ある・ 外にある設定は使えない コンパイルできない
@charset "utf-8";

これを一行目にいれる
必要なのは

// out: true

これのみ

他のオプショイン

https://marketplace.visualstudio.com/items?itemName=mrcrowl.easy-less

// out: "../dist/app.css", compress: true, sourceMap: false

 

cssの分岐

<?php 
$contorol_slider =  get_field("contorol_slider",$site_con_id);//スライダーの選択

if($contorol_slider == 'FULL_動画'): ////////////////////////////////////////// ?>
     <?php $file_pass = '/2_slider/slider_g_mov/swiper_slider_g.css';//ファイルパス  
     //子テーマにcssあれば 
     $css_url = get_stylesheet_directory().$file_pass;  ?>
      <?php if (file_exists($css_url)):?>
       <link href="<?php echo get_stylesheet_directory_uri() .$file_pass?>?<?php echo filemtime( get_stylesheet_directory().$file_pass); ?>" rel="stylesheet" type="text/css" />
  <?php else: // なければ親テーマ読み込む?>
      <link href="<?php echo get_template_directory_uri() .$file_pass ?>?<?php echo filemtime( get_template_directory().$file_pass); ?>" rel="stylesheet" type="text/css" />
   <?php endif; //END d_1_init.cssあれば 202509 FULL?>

   <?php  elseif($contorol_slider == 'UTM'): ////////////////////////////////////////// ?>
    
     <?php $file_pass = '/2_slider/slider_f_utm/swiper_slider_f.css';//ファイルパス  
     //子テーマにcssあれば 
     $css_url = get_stylesheet_directory().$file_pass;  ?>
      <?php if (file_exists($css_url)):?>
       <link href="<?php echo get_stylesheet_directory_uri() .$file_pass?>?<?php echo filemtime( get_stylesheet_directory().$file_pass); ?>" rel="stylesheet" type="text/css" />
  <?php else: // なければ親テーマ読み込む?>
      <link href="<?php echo get_template_directory_uri() .$file_pass ?>?<?php echo filemtime( get_template_directory().$file_pass); ?>" rel="stylesheet" type="text/css" />
   <?php endif; //END d_1_init.cssあれば 202509 FULL?>
  



  <?php endif; //////////////////////////////////////////?>

これで書き換えるだけで キャッシュクリア 子テーマに移動させた場合、そっちを自動で読み込む

後は swiperの分岐?

 

【テーマFULL】welcart の構造

FULL/4_custom/welcart/wc_cart_page.php

4_custom welcart に関して

wc_confirm_page.php含む4ファイルをここに収納している

このファイルを指定している大元は

FULL/wc_templatesである

FULL/wc_templates/cart/wc_cart_page.php

ここのファイルを

<?php include locate_template("/4_custom/welcart/wc_cart_page.php"); ?>

として、

FULL/4_custom/welcart/wc_cart_page.phpに転送している感じ

となるともはや、wc_templatesに

FULL/4_custom/welcart/ の内容を入れて管理すればよいのでは??

ここの

前回の記事の続き ローカルにwpを再現 する方法 キホン覚え back wp up

落とした、フルのバックアップのフォルダを入れ替えて、DB差し込んでも

うまく動かない。

よくわからないが、DBをDLして、ローカルに入れても wpのバージョンが違ったせいか、ログインできなくなった パスあってるのに

 

そこで、いつも通り、

キホンに゙帰り

wpを両方とも最新に変更

DBをDL これはバックアップのでもおkだった

バックアップしたフォルダ

アップロードフォルダ

プラグインフォルダ

(テーマフォルダ)

のみ入れ替えて DB差し込みローカルサイトに変更したらうまくいっった、

 

mampのphpmyadmin5 でDBインスト 大きいファイルは エラーが出ても 触ってはいけない

40mbのDBだと 500エラーがでて真っ白

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at you@example.com to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

これをそのままほかって置くとインストできる

しかし、すぐローカルのtopなどにいくと 駄目  DBをダウンロードしてみれば

サイズが少ないのでわかる

エラーログは

file:///Applications/MAMP/logs/apache_error.log

にあり、読むとなぜじゃ

[Tue Dec 02 15:28:04.916879 2025] [fastcgi:error] [pid 20285] [client ::1:50152] FastCGI: comm with server "/Applications/MAMP/fcgi-bin/php7.4.33.fcgi" aborted: idle timeout (30 sec)
[Tue Dec 02 15:28:04.917449 2025] [fastcgi:error] [pid 20285] [client ::1:50152] FastCGI: incomplete headers (0 bytes) received from server "/Applications/MAMP/fcgi-bin/php7.4.33.fcgi"

とあり なぜか、php7.4.33でタイムアウトしてる このphpをつかてるのか?

phpmyadmin5のtopにかいてあった

7.4.33のタイムアウトを長くしてみよう。

 

ここに書いてああった

https://stackoverflow.com/questions/76079982/how-to-stop-30s-timeouts-in-mamp

 

MAMPで、「ファイル」→「テンプレートを開く」→「Apache」→「httpd.conf」と進み、ファイル内で以下の項目を検索します。

MAMP_FastCgiServer_MAMP

 

MAMP_FastCgiServer_MAMP -idle-timeout 300

 

これでタイムアウトはしなかった

でも 駄目だった

DBでないかも

get_template_directory get_template_directory_uri 違い

get_template_directory()
テーマのファイルシステム上での絶対パス(例: /var/www/html/wp-content/themes/theme-name)を返し、

主にサーバー上でファイルを操作する(インクルードするなど)場合はget_template_directory()を、

phpスクリプトから requireで読み込むとかファイルとして開くときに

get_template_directory_uri()
URL(例: https://example.com/wp-content/themes/theme-name)を返します。

Webブラウザで表示するために画像などを読み込む場合はget_template_directory_uri()を使用します。

サブドメインで 転送がうまくいかなかた 対処法

Redirect permanent /不用品回収を小牧市の専門業者に依頼する理由/ https://komaki.life-serv.com/不用品回収を小牧市の専門業者に依頼する理由と/

Redirect permanent /愛知県小牧市で粗大ごみ回収の書類pdf/ https://komaki.life-serv.com/愛知県小牧市で粗大ごみ回収の書類pdf2/


Redirect permanent /小牧-不用品回収|違法業者に注意!おすすめサー/ https://komaki.life-serv.com/小牧-不用品回収|違法業者に注意!おすすめ2/

 

キャッシュがのこる プライベート 全消しで確認

url かえてた

life 小牧  ブログ ループ リンク出力時に サブドメイン からドメインURLに

///サブドメインURLを ドメインに変更して出力
$url = get_permalink();

// URL を分解
$parts = parse_url($url);

// ホスト部分をドメインに変換
$hostParts = explode('.', $parts['host']);

// サブドメインを削除(最後の2つを残す)
$domain = implode('.', array_slice($hostParts, -2));

// 新しい URL を構築
$newUrl = $parts['scheme'] . "://" . $domain;
if (isset($parts['path'])) {
    $newUrl .= $parts['path'];
}
if (isset($parts['query'])) {
    $newUrl .= '?' . $parts['query'];
}

 

swiper centeredSlides:true slidesPerView: ‘auto’ cssでサイズ選択して、中央表示にすると、最後の画像から始まる

top1のスライドで、登録した順に表示したいが、そうすると、

さいごの画像から始まる

ループを切ると、治る が左が開く

slidesPerView: ‘auto’ を切ると

swiper のデフォルト機能を使って表示できる

その場合はうまくいくが、

なんだか、表示したときにサイズが大きいのから小さくなる動きが見えてはじまるので、検証の必要あり

centeredSlides:true を指定して、

initialSlide:0,// 0スタートで表示順調整

slidesPerView: ‘auto’

の場合、最後から

initialSlide:1,// 0スタートで表示順調整

で2枚目から始まってしまう。

 

なんで、最初が肝心な場合はループ切る

サイトのデータベース 管理画面から投稿タイプをコントール

ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー
▶css  lessではなく カスタム投稿タイプはcssを使う そして管理画面にて分岐 使う使わない
▶fanc 投稿タイプの利用未利用は管理画面から可能 phpのため
そーすれば、使うか使わないかは、DBで管理できるので、親テーマに入れとけばよくなるのでは????
ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー

 

親テーマファンクション

///////////////////カスタム投稿タイプ/////////////////

///カスタム投稿タイプ welcartfanckを管理画面でインサート
$c_cutom_post_type =  get_field("cutom_post_type",7140);


if (in_array("地域", $c_cutom_post_type)) {
// 地域
require_once locate_template('4_custom/service_chiiki/service_chiiki_func.php');  
}

if (in_array("実績", $c_cutom_post_type)) {
// KEN設計 からの 事例
require_once locate_template('4_custom/newlybuilt/newlybuilt_func.php'); 
}

if (in_array("youtube", $c_cutom_post_type)) {
// youtube
require_once locate_template('4_custom/youtube/youtube_func.php'); 
}


if (in_array("中古車", $c_cutom_post_type)) {
// 中古車
require_once locate_template('4_custom/car/car_func.php');  
  }

if (in_array("イベント", $c_cutom_post_type)) {
// イベント お昼レゲエ 202502
require_once locate_template('4_custom/event/event_func.php');  
}


    if (in_array("スタッフ簡易202501", $c_cutom_post_type)) {
// スタッフ簡易202501
require_once locate_template('4_custom/staff202501/staff202501_func.php');  
  }

      if (in_array("スタッフ個ページあり202502", $c_cutom_post_type)) {
// スタッフ 個ページ あり 202502
require_once locate_template('4_custom/staff202502/staff202502_func.php');  
  }

if (in_array("レッスンヨガアース", $c_cutom_post_type)) {
// レッスン  ヨガ アース
require_once locate_template('4_custom/lesson/lesson_func.php');  
  }

  

//////////////使い道なし

// HP制作実績
//require_once locate_template('4_custom/d_jirei_hp/d_jirei_hp_func.php');  

// お客様の声
//require_once locate_template('4_custom/koe/koe_func.php');  


///////////////////オンラインショップ/////////////////
if (in_array("welcart", $c_cutom_post_type)) {
// welcart
require_once locate_template('4_custom/welcart/welcart_func.php'); 
  }else{
    //welcart_fancを入れない場合、エラーになるから  これをオープンする
//空で指定
$welcart_cat = '';
$welcart_cat_out = '';
$itemreco  = '';
$itemnew = '';
$welcart_genre = '';
  }

 

親テーマ d_0header

init.css の後に

  <?php //202510 管理画面にてCSSをコントロール  カスタム投稿タイプと連動  条件は lessを cssにしなければならない 
  $c_cutom_post_type =  get_field("cutom_post_type",7140);//welcartのテンプレートではこれを読めないからここに再度記載
   ?>
    <?php //welcart
    if (in_array("レッスンヨガアース", $c_cutom_post_type)) : ?>
          <link href="<?php echo get_template_directory_uri(); ?>/4_custom/welcart/welcart.css?<?php echo filemtime( get_template_directory()."/4_custom/welcart/welcart.css"); ?>" rel="stylesheet" type="text/css" />
    <?php endif; ?>

 

css

f1_colorに

:root {


      --site_color  : #000000; //サイトの基本カラー

    }

welcart.css コメントアウト その他調整必要

/* //カートに入れるをボタン */
#welcart_single {




        input.skubutton {

            width: 100%;
    font-size: 16px;
    padding: 0.8em;
    background-color: var(--site_color);
    color: #fff;



    }

}

 

サブドメインのサイトで本サイトへcanonicalを送る

<?php ///////////////////////// canonical //////////////////////////// ?>

   <?php if(is_singular('post')): //ブログなら?>
 
     <?php $title =  $post->post_name;; ?>
    <link rel="canonical" href="https://life-serv.com/<?php echo $title ?>/">

   <?php endif; ?>

       <?php if(is_singular('jisseki')): //実績なら?>
 
      <?php $title =  $post->post_name;; ?>
    <link rel="canonical" href="https://life-serv.com/<?php echo $title ?>/">

   <?php endif; ?>


     <?php if(is_archive( )): //アーカイブで  これはカテゴリーと、月間アーカイブ,タグ?>



    <?php 
    $term = get_queried_object();
     $term_url = get_term_link($term); 

         ///ドメインURLを ドメインに変更して出力

         // URL を分解
         $parts = parse_url($term_url);
         // ホスト部分をドメインに変換
         $hostParts = explode('.', $parts['host']);
         // サブドメインを削除(最後の2つを残す)
         $domain = implode('.', array_slice($hostParts, -2));
         // 新しい URL を構築
         $newUrl = $parts['scheme'] . "://" . $domain;
         if (isset($parts['path'])) {
             $newUrl .= $parts['path'];
         }
         if (isset($parts['query'])) {
             $newUrl .= '?' . $parts['query'];
         }
     
     ?>

       <link rel="canonical" href="<?php echo $newUrl ?>">
 
  <?php endif; ?>

  
    <?php ///////////////////////// canonical END //////////////////////////// ?>

ヘッダーに

gtpに聞いた サブドメインをドメインに置き換え get_permalink

///サブドメインURLを ドメインに変更して出力
$url = get_permalink();

// URL を分解
$parts = parse_url($url);

// ホスト部分をドメインに変換
$hostParts = explode('.', $parts['host']);

// サブドメインを削除(最後の2つを残す)
$domain = implode('.', array_slice($hostParts, -2));

// 新しい URL を構築
$newUrl = $parts['scheme'] . "://" . $domain;
if (isset($parts['path'])) {
    $newUrl .= $parts['path'];
}
if (isset($parts['query'])) {
    $newUrl .= '?' . $parts['query'];
}

//echo $newUrl;

地域対策サブドメインページにて