【テーマ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;

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

wp テーマの仕組み

親テーマにも

子テーマにも

8_page/aaa.php

をおいた場合、

管理画面からページテンプレートを使う場合、子テーマが表示される

親テーマのテンプレートは、

8_page2/aaa.php と、親ページのフォルダ名を違うものにした場合のみ表示される

 

また、ページテンプレートを同じにはできない。

同じにする場合、親テーマのほうが優先される

子テーマのページテンプレートを選んでおり、その後、そのテンプレート名を親テーマと同じ名前にしても、勝手に親テーマのテンプレートが選ばれない デフォルトに戻る

 

 

結果どうすればよいか

 

 

 

セレクト select 矢印 変更 セレクトでリンク作成

///セレクトの矢印を変える

.select_wrapper {
    position: relative;
    display: inline-block!important;
    width: auto!important;

&:after {
    content: "";
    position: absolute;
    top: 18px;
    right: 16px;
    width: 12px;
    height: 12px;
    border-right: 2px solid #333;
    border-bottom: 2px solid #333;
    transform: rotate(45deg);
 pointer-events: none;//これ入れないと、矢印で機能しなくなる
}

select {
    -webkit-appearance: none;
    appearance: none;
font-size: 13px;
    
}
}
 <ul class="single_foot_menu select_wrapper">
     <?php wp_dropdown_categories(
 array(
 'title_li' => '',
 'hide_empty'         => $hide_empty,
'taxonomy' => $menu_trem,
'depth'              => 1,
'orderby' => 'menu_order',//順番は指定します
//'exclude'=> array(2,5)
)
); 


//孫の親の出力準備 2025.01追記 3階層まで対応したい 親 子 孫

$granpma_id = NULL;//変数の初期化

$granpmas = get_terms( array( 'taxonomy'=> $menu_trem, 'parent' => 0, ) );

// echo "<pre>";
// print_r($granpmas);
// echo "</pre>";




foreach($granpmas as $granpma):////フォーチ----------------------------
  $granpma_id[] = $granpma->term_id; //小タームidをセット

 endforeach; 
  
//  echo "<pre>";
//  print_r($granpma_id);
//  echo "</pre>";

//孫の親準備END




?>
    
  </ul>

 

上記リンク出ない

なので、リンク作成時は別のコード

セレクトでリンク作成

<?php $cats = get_categories(array(
'post_type' => 'car',
'taxonomy' => 'car_cat3' ,
'hide_empty' => 0 ,//記事がなくとも表示
'depth' => 1,//子は表示しません。
'orderby' => 'order',//順番は指定します
)); ?>
<?php if(!empty($cats)): ?>
<select name="car_cat1" id="car_cat1">
<option value=" "> 詳細項目で選ぶ</option>
<?php  foreach($cats as $cat): ?>
<option value="<?php $cat_term = $cat->slug; echo get_term_link($cat_term ,'car_cat3'); ?>"><?php echo $cat->cat_name; ?>(<?php echo $cat->count; ?>)</option>
<?php endforeach; ?>
</select>

<script type="text/javascript">
var dropdown = document.getElementById("car_cat1");
function onCatChange(){
    if(dropdown.options[dropdown.selectedIndex].value != ""){
        location.href = dropdown.options[dropdown.selectedIndex].value;
    }
}
dropdown.onchange = onCatChange;
</script>
<?php endif; ?>

</ul>

getElementById(“car_cat1”);

の部分のIDの要素を指定して変更しているので

同じ名前のフォームがあると動作しない

実際、商品のフォームが見えていなく隠れていて、悪さしていため

出来なかったから名前を変更した

子テーマになければ 親テーマ を探す

<?php elseif ($page_make_choice == 'インクルードURL'): //include_pas版
    
    //echo $field['include_pas']
    
    ?>

   <?php //202509 子テーマになければ 親テーマを探す

    $choice_url = get_stylesheet_directory(). $field['include_pas']; //子テーマURL ?>
        <?php if (file_exists($choice_url)): //あるか??>

         <?php include $choice_url ;  ?>
         

    <?php else: // なければ?>

         <?php $choice_url = get_template_directory(). $field['include_pas']; //親テーマURL ?>
        <?php if (file_exists($choice_url)): //あるか??>

  <?php include $choice_url ;  ?>

     <?php endif; //END 親テーマURLあれば ?>

<?php endif; //子テーマになければ 親テーマを探す?>
<?php elseif($con_choice == 'con_include'):  //con_include_pas版 ?>

   <?php //202509 子テーマになければ 親テーマを探す

    $choice_url = get_stylesheet_directory(). $field['con_include_pas']; //子テーマURL ?>
        <?php if (file_exists($choice_url)): //あるか??>

         <?php include $choice_url ;  ?>
         

    <?php else: // なければ?>

         <?php $choice_url = get_template_directory(). $field['con_include_pas']; //親テーマURL ?>
        <?php if (file_exists($choice_url)): //あるか??>

  <?php include $choice_url ;  ?>

     <?php endif; //END 親テーマURLあれば ?>

<?php endif; //子テーマになければ 親テーマを探す?>
   <?php //子テーマにd_1_init.cssあれば 202509 FULL

   $css_url = get_stylesheet_directory()."/d_1_init.css";  ?>
    <?php if (file_exists($css_url)):?>
     <link href="<?php echo get_stylesheet_directory_uri(); ?>/d_1_init.css?<?php echo filemtime( get_stylesheet_directory()."/d_1_init.css"); ?>" rel="stylesheet" type="text/css" />

<?php else: // なければ親テーマ読み込む?>

    <link href="<?php echo get_template_directory_uri(); ?>/d_1_init.css?<?php echo filemtime( get_template_directory()."/d_1_init.css"); ?>" rel="stylesheet" type="text/css" />

 <?php endif; //END d_1_init.cssあれば 202509 FULL?>