3v4l.org

run code in 500+ PHP versions simultaneously
<?php function kotonoha_setup() { add_theme_support('title-tag'); add_theme_support('post-thumbnails'); add_theme_support('automatic-feed-links'); add_theme_support('html5', array('search-form', 'gallery', 'caption')); } add_action('after_setup_theme', 'kotonoha_setup'); function kotonoha_enqueue_assets() { $uri = get_template_directory_uri(); wp_enqueue_style('kotonoha-style', $uri . '/css/style.css', array(), '1.0.0'); wp_enqueue_script('kotonoha-cursor', $uri . '/js/cursor.js', array(), '1.0.0', true); } add_action('wp_enqueue_scripts', 'kotonoha_enqueue_assets'); /* ============================================================ * 不動産サンプル記事(カスタム投稿タイプ)+ 専用カテゴリ * -------------------------------------------------------------- * LP「不動産会社向けサイト制作」のサンプル記事を、本体の通常投稿(post)と * 完全に分離して管理・表示するための登録。 * - 投稿タイプ : re_sample(専用メニュー) * - 単一URL : /real-estate-web/sample/{記事スラッグ}/ * - 一覧 : /real-estate-web/sample/(アーカイブ) * - 分類 : re_sample_cat(「相続」「空き家」等で分類) * post とは別タイプのため、本体のブログ/コラム一覧(postのループ)には出ません。 * ============================================================ */ if ( ! function_exists( 'kotonoha_register_re_sample' ) ) { function kotonoha_register_re_sample() { // ── 専用カテゴリ(タクソノミー):相続・空き家 などで分類 ── $re_sample_tax_labels = array( 'name' => '不動産サンプル記事カテゴリ', 'singular_name' => '不動産サンプル記事カテゴリ', 'menu_name' => 'カテゴリ', 'all_items' => 'すべてのカテゴリ', 'edit_item' => 'カテゴリを編集', 'view_item' => 'カテゴリを表示', 'update_item' => 'カテゴリを更新', 'add_new_item' => '新規カテゴリを追加', 'new_item_name' => '新しいカテゴリ名', 'search_items' => 'カテゴリを検索', ); register_taxonomy( 're_sample_cat', array( 're_sample' ), array( 'labels' => $re_sample_tax_labels, 'hierarchical' => true, // カテゴリ型(チェックボックス選択) 'public' => true, 'show_ui' => true, 'show_admin_column' => true, 'show_in_rest' => true, 'rewrite' => array( 'slug' => 'real-estate-web/sample/category', 'with_front' => false, ), ) ); // ── カスタム投稿タイプ:不動産サンプル記事 ── $re_sample_cpt_labels = array( 'name' => '不動産サンプル記事', 'singular_name' => '不動産サンプル記事', 'menu_name' => '不動産サンプル記事', 'add_new' => '新規追加', 'add_new_item' => '新規サンプル記事を追加', 'edit_item' => 'サンプル記事を編集', 'new_item' => '新規サンプル記事', 'view_item' => 'サンプル記事を表示', 'view_items' => 'サンプル記事一覧を表示', 'search_items' => 'サンプル記事を検索', 'not_found' => 'サンプル記事が見つかりませんでした', 'not_found_in_trash' => 'ゴミ箱にサンプル記事はありません', 'all_items' => 'サンプル記事一覧', ); register_post_type( 're_sample', array( 'labels' => $re_sample_cpt_labels, 'public' => true, 'show_ui' => true, 'show_in_menu' => true, // 管理画面に専用メニューとして表示 'show_in_rest' => true, // ブロックエディタ対応 'menu_icon' => 'dashicons-admin-home', 'menu_position' => 25, 'hierarchical' => false, 'has_archive' => 'real-estate-web/sample', // 一覧(アーカイブ) 'rewrite' => array( 'slug' => 'real-estate-web/sample', // 単一記事のURL基点 'with_front' => false, ), // 本体ブログ(post)と分離:通常投稿のループには含まれない 'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail' ), 'taxonomies' => array( 're_sample_cat' ), ) ); } } add_action( 'init', 'kotonoha_register_re_sample' ); /* ============================================================ * 記事末 CTA ショートコード [kcta type="..."] * -------------------------------------------------------------- * 記事本文の末尾に [kcta type="realestate"] のように書くと、 * 対応する CTA ブロックを表示する。 * type="realestate" 不動産サイト制作・Web集客 * type="shigyo" 士業サイト制作 * type="ai" AI記事監修 * type="general" コンテンツ制作のご相談(type 省略・不正時の既定値) * スタイルは style.css の .kcta__ 系クラスに定義(<style> の都度出力はしない)。 * リンク先スラッグは固定。home_url()+esc_url() でURL、esc_html() で文言をエスケープ。 * ============================================================ */ if ( ! function_exists( 'kotonoha_cta_shortcode' ) ) { function kotonoha_cta_shortcode( $atts ) { $atts = shortcode_atts( array( 'type' => 'general' ), $atts, 'kcta' ); $ctas = array( 'realestate' => array( 'label' => '不動産サイト制作・Web集客', 'title' => '反響につながる不動産サイトを、一緒に。', 'desc' => '不動産会社のサイト制作からSEO・専門コンテンツまで、宅建士資格を持つ作り手が一貫して支援します。', 'btn' => '不動産サイト制作について見る', 'slug' => '/real-estate-web/', ), 'shigyo' => array( 'label' => '士業サイト制作', 'title' => '専門性と相談しやすさが伝わるサイトへ。', 'desc' => '士業事務所の強みや専門分野を整理し、初めて訪れた方にも伝わるサイト設計と文章制作を支援します。', 'btn' => '士業サイト制作について見る', 'slug' => '/shigyo-web/', ), 'ai' => array( 'label' => 'AI記事監修', 'title' => 'AI原稿を、そのまま公開していませんか?', 'desc' => '事実確認・表現調整・構成改善まで、有資格の編集者が公開前の原稿を確認します。', 'btn' => 'AI記事監修について見る', 'slug' => '/ai-article-supervision/', ), 'general' => array( 'label' => 'コンテンツ制作のご相談', 'title' => '言葉まわりのこと、まるごと相談できます。', 'desc' => '記事制作・編集・サイト制作まで、必要な範囲からご相談いただけます。', 'btn' => 'お問い合わせはこちら', 'slug' => '/contact/', ), ); // type が省略・不正な値のときは general を表示 $type = isset( $atts['type'] ) ? strtolower( trim( $atts['type'] ) ) : 'general'; if ( ! isset( $ctas[ $type ] ) ) { $type = 'general'; } $cta = $ctas[ $type ]; $url = esc_url( home_url( $cta['slug'] ) ); $html = '<aside class="kcta kcta--' . esc_attr( $type ) . '">'; $html .= '<p class="kcta__label">' . esc_html( $cta['label'] ) . '</p>'; $html .= '<h3 class="kcta__title">' . esc_html( $cta['title'] ) . '</h3>'; $html .= '<p class="kcta__desc">' . esc_html( $cta['desc'] ) . '</p>'; $html .= '<a class="kcta__btn" href="' . $url . '">' . esc_html( $cta['btn'] ) . '</a>'; $html .= '</aside>'; return $html; } add_shortcode( 'kcta', 'kotonoha_cta_shortcode' ); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 14
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 28
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
Branch analysis from position: 14
filename:       /in/sgTj6
function name:  (null)
number of ops:  29
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   INIT_FCALL_BY_NAME                                           'add_action'
          1        SEND_VAL_EX                                                  'after_setup_theme'
          2        SEND_VAL_EX                                                  'kotonoha_setup'
          3        DO_FCALL                                          0          
   15     4        INIT_FCALL_BY_NAME                                           'add_action'
          5        SEND_VAL_EX                                                  'wp_enqueue_scripts'
          6        SEND_VAL_EX                                                  'kotonoha_enqueue_assets'
          7        DO_FCALL                                          0          
   28     8        INIT_FCALL                                                   'function_exists'
          9        SEND_VAL                                                     'kotonoha_register_re_sample'
         10        DO_ICALL                                             $2      
         11        BOOL_NOT                                             ~3      $2
         12      > JMPZ                                                         ~3, ->14
   29    13    >   DECLARE_FUNCTION                                             'kotonoha_register_re_sample'
   93    14    >   INIT_FCALL_BY_NAME                                           'add_action'
         15        SEND_VAL_EX                                                  'init'
         16        SEND_VAL_EX                                                  'kotonoha_register_re_sample'
         17        DO_FCALL                                          0          
  107    18        INIT_FCALL                                                   'function_exists'
         19        SEND_VAL                                                     'kotonoha_cta_shortcode'
         20        DO_ICALL                                             $5      
         21        BOOL_NOT                                             ~6      $5
         22      > JMPZ                                                         ~6, ->28
  108    23    >   DECLARE_FUNCTION                                             'kotonoha_cta_shortcode'
  160    24        INIT_FCALL_BY_NAME                                           'add_shortcode'
         25        SEND_VAL_EX                                                  'kcta'
         26        SEND_VAL_EX                                                  'kotonoha_cta_shortcode'
         27        DO_FCALL                                          0          
  161    28    > > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sgTj6
function name:  kotonoha_register_re_sample
number of ops:  31
compiled vars:  !0 = $re_sample_tax_labels, !1 = $re_sample_cpt_labels
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   32     0  E >   ASSIGN                                                       !0, <array>
   44     1        INIT_FCALL_BY_NAME                                           'register_taxonomy'
          2        SEND_VAL_EX                                                  're_sample_cat'
          3        SEND_VAL_EX                                                  <array>
   45     4        INIT_ARRAY                                           ~3      !0, 'labels'
          5        ADD_ARRAY_ELEMENT                                    ~3      <true>, 'hierarchical'
          6        ADD_ARRAY_ELEMENT                                    ~3      <true>, 'public'
          7        ADD_ARRAY_ELEMENT                                    ~3      <true>, 'show_ui'
          8        ADD_ARRAY_ELEMENT                                    ~3      <true>, 'show_admin_column'
          9        ADD_ARRAY_ELEMENT                                    ~3      <true>, 'show_in_rest'
         10        ADD_ARRAY_ELEMENT                                    ~3      <array>, 'rewrite'
         11        SEND_VAL_EX                                                  ~3
   44    12        DO_FCALL                                          0          
   58    13        ASSIGN                                                       !1, <array>
   73    14        INIT_FCALL_BY_NAME                                           'register_post_type'
         15        SEND_VAL_EX                                                  're_sample'
   74    16        INIT_ARRAY                                           ~6      !1, 'labels'
         17        ADD_ARRAY_ELEMENT                                    ~6      <true>, 'public'
         18        ADD_ARRAY_ELEMENT                                    ~6      <true>, 'show_ui'
         19        ADD_ARRAY_ELEMENT                                    ~6      <true>, 'show_in_menu'
         20        ADD_ARRAY_ELEMENT                                    ~6      <true>, 'show_in_rest'
   79    21        ADD_ARRAY_ELEMENT                                    ~6      'dashicons-admin-home', 'menu_icon'
   80    22        ADD_ARRAY_ELEMENT                                    ~6      25, 'menu_position'
   74    23        ADD_ARRAY_ELEMENT                                    ~6      <false>, 'hierarchical'
   82    24        ADD_ARRAY_ELEMENT                                    ~6      'real-estate-web%2Fsample', 'has_archive'
   74    25        ADD_ARRAY_ELEMENT                                    ~6      <array>, 'rewrite'
         26        ADD_ARRAY_ELEMENT                                    ~6      <array>, 'supports'
         27        ADD_ARRAY_ELEMENT                                    ~6      <array>, 'taxonomies'
         28        SEND_VAL_EX                                                  ~6
   73    29        DO_FCALL                                          0          
   91    30      > RETURN                                                       null

End of Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 17
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 23
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 23
Branch analysis from position: 22
Branch analysis from position: 23
filename:       /in/sgTj6
function name:  kotonoha_cta_shortcode
number of ops:  77
compiled vars:  !0 = $atts, !1 = $ctas, !2 = $type, !3 = $cta, !4 = $url, !5 = $html
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  108     0  E >   RECV                                                 !0      
  109     1        INIT_FCALL_BY_NAME                                           'shortcode_atts'
          2        SEND_VAL_EX                                                  <array>
          3        SEND_VAR_EX                                                  !0
          4        SEND_VAL_EX                                                  'kcta'
          5        DO_FCALL                                          0  $6      
          6        ASSIGN                                                       !0, $6
  111     7        ASSIGN                                                       !1, <array>
  143     8        ISSET_ISEMPTY_DIM_OBJ                             0          !0, 'type'
          9      > JMPZ                                                         ~9, ->17
         10    >   INIT_FCALL                                                   'strtolower'
         11        FETCH_DIM_R                                          ~10     !0, 'type'
         12        FRAMELESS_ICALL_1                trim                ~11     ~10
         13        SEND_VAL                                                     ~11
         14        DO_ICALL                                             $12     
         15        QM_ASSIGN                                            ~13     $12
         16      > JMP                                                          ->18
         17    >   QM_ASSIGN                                            ~13     'general'
         18    >   ASSIGN                                                       !2, ~13
  144    19        ISSET_ISEMPTY_DIM_OBJ                             0  ~15     !1, !2
         20        BOOL_NOT                                             ~16     ~15
         21      > JMPZ                                                         ~16, ->23
  145    22    >   ASSIGN                                                       !2, 'general'
  147    23    >   FETCH_DIM_R                                          ~18     !1, !2
         24        ASSIGN                                                       !3, ~18
  149    25        INIT_FCALL_BY_NAME                                           'esc_url'
         26        INIT_FCALL_BY_NAME                                           'home_url'
         27        CHECK_FUNC_ARG                                               
         28        FETCH_DIM_FUNC_ARG                                   $20     !3, 'slug'
         29        SEND_FUNC_ARG                                                $20
         30        DO_FCALL                                          0  $21     
         31        SEND_VAR_NO_REF_EX                                           $21
         32        DO_FCALL                                          0  $22     
         33        ASSIGN                                                       !4, $22
  151    34        INIT_FCALL_BY_NAME                                           'esc_attr'
         35        SEND_VAR_EX                                                  !2
         36        DO_FCALL                                          0  $24     
         37        CONCAT                                               ~25     '%3Caside+class%3D%22kcta+kcta--', $24
         38        CONCAT                                               ~26     ~25, '%22%3E'
         39        ASSIGN                                                       !5, ~26
  152    40        INIT_FCALL_BY_NAME                                           'esc_html'
         41        CHECK_FUNC_ARG                                               
         42        FETCH_DIM_FUNC_ARG                                   $28     !3, 'label'
         43        SEND_FUNC_ARG                                                $28
         44        DO_FCALL                                          0  $29     
         45        CONCAT                                               ~30     '%3Cp+class%3D%22kcta__label%22%3E', $29
         46        CONCAT                                               ~31     ~30, '%3C%2Fp%3E'
         47        ASSIGN_OP                                         8          !5, ~31
  153    48        INIT_FCALL_BY_NAME                                           'esc_html'
         49        CHECK_FUNC_ARG                                               
         50        FETCH_DIM_FUNC_ARG                                   $33     !3, 'title'
         51        SEND_FUNC_ARG                                                $33
         52        DO_FCALL                                          0  $34     
         53        CONCAT                                               ~35     '%3Ch3+class%3D%22kcta__title%22%3E', $34
         54        CONCAT                                               ~36     ~35, '%3C%2Fh3%3E'
         55        ASSIGN_OP                                         8          !5, ~36
  154    56        INIT_FCALL_BY_NAME                                           'esc_html'
         57        CHECK_FUNC_ARG                                               
         58        FETCH_DIM_FUNC_ARG                                   $38     !3, 'desc'
         59        SEND_FUNC_ARG                                                $38
         60        DO_FCALL                                          0  $39     
         61        CONCAT                                               ~40     '%3Cp+class%3D%22kcta__desc%22%3E', $39
         62        CONCAT                                               ~41     ~40, '%3C%2Fp%3E'
         63        ASSIGN_OP                                         8          !5, ~41
  155    64        CONCAT                                               ~43     '%3Ca+class%3D%22kcta__btn%22+href%3D%22', !4
         65        CONCAT                                               ~44     ~43, '%22%3E'
         66        INIT_FCALL_BY_NAME                                           'esc_html'
         67        CHECK_FUNC_ARG                                               
         68        FETCH_DIM_FUNC_ARG                                   $45     !3, 'btn'
         69        SEND_FUNC_ARG                                                $45
         70        DO_FCALL                                          0  $46     
         71        CONCAT                                               ~47     ~44, $46
         72        CONCAT                                               ~48     ~47, '%3C%2Fa%3E'
         73        ASSIGN_OP                                         8          !5, ~48
  156    74        ASSIGN_OP                                         8          !5, '%3C%2Faside%3E'
  158    75      > RETURN                                                       !5
  159    76*     > RETURN                                                       null

End of Dynamic Function 1

Function kotonoha_setup:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sgTj6
function name:  kotonoha_setup
number of ops:  14
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL_BY_NAME                                           'add_theme_support'
          1        SEND_VAL_EX                                                  'title-tag'
          2        DO_FCALL                                          0          
    4     3        INIT_FCALL_BY_NAME                                           'add_theme_support'
          4        SEND_VAL_EX                                                  'post-thumbnails'
          5        DO_FCALL                                          0          
    5     6        INIT_FCALL_BY_NAME                                           'add_theme_support'
          7        SEND_VAL_EX                                                  'automatic-feed-links'
          8        DO_FCALL                                          0          
    6     9        INIT_FCALL_BY_NAME                                           'add_theme_support'
         10        SEND_VAL_EX                                                  'html5'
         11        SEND_VAL_EX                                                  <array>
         12        DO_FCALL                                          0          
    7    13      > RETURN                                                       null

End of function kotonoha_setup

Function kotonoha_enqueue_assets:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sgTj6
function name:  kotonoha_enqueue_assets
number of ops:  19
compiled vars:  !0 = $uri
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL_BY_NAME                                           'get_template_directory_uri'
          1        DO_FCALL                                          0  $1      
          2        ASSIGN                                                       !0, $1
   12     3        INIT_FCALL_BY_NAME                                           'wp_enqueue_style'
          4        SEND_VAL_EX                                                  'kotonoha-style'
          5        CONCAT                                               ~3      !0, '%2Fcss%2Fstyle.css'
          6        SEND_VAL_EX                                                  ~3
          7        SEND_VAL_EX                                                  <array>
          8        SEND_VAL_EX                                                  '1.0.0'
          9        DO_FCALL                                          0          
   13    10        INIT_FCALL_BY_NAME                                           'wp_enqueue_script'
         11        SEND_VAL_EX                                                  'kotonoha-cursor'
         12        CONCAT                                               ~5      !0, '%2Fjs%2Fcursor.js'
         13        SEND_VAL_EX                                                  ~5
         14        SEND_VAL_EX                                                  <array>
         15        SEND_VAL_EX                                                  '1.0.0'
         16        SEND_VAL_EX                                                  <true>
         17        DO_FCALL                                          0          
   14    18      > RETURN                                                       null

End of function kotonoha_enqueue_assets

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
176.25 ms | 1415 KiB | 15 Q