• WpテーマのTimeTurnerを使ってサイトを構築しようとしております。
    functions.phpに追記したくしてみたのですが、反映されません。
    記述内容には問題がない事は他のテーマ内に追記してみて検証済みです。

    記述する場所、もしくは記述の際等のルールがあるのでしょうか。

1件の返信を表示中 - 1 - 1件目 (全1件中)
  • トピック投稿者 momonuts

    (@momonuts)

    ちなみにfunctionにはcontactform7にカスタム投稿で作った項目の値を挿入させるためのものです。
    コードは以下になります。

    add_filter('wpcf7_special_mail_tags', 'my_special_mail_tags',10,2);
    
    function my_special_mail_tags($output, $name)
    {
        //UAとIPを追加
        if(!isset($re_agent)){ $re_agent = $_SERVER['HTTP_USER_AGENT']; }
        if('user_agent' == $name){ $output = $re_agent; }
        if(!isset($re_addr)){ $re_addr = $_SERVER['REMOTE_ADDR']; }
        if('remote_addr' == $name){ $output = gethostbyaddr($re_addr); }
    
        //特別なタグを追加
        if ( ! isset( $_POST['_wpcf7_unit_tag'] ) || empty( $_POST['_wpcf7_unit_tag'] ) )
            return $output;
        if ( ! preg_match( '/^wpcf7-f(\d+)-p(\d+)-o(\d+)$/', $_POST['_wpcf7_unit_tag'], $matches ) )
            return $output;
    
        $post_id = (int) $matches[2];
        if ( ! $post = get_post( $post_id ) )
            return $output;
    
        $name = preg_replace( '/^wpcf7\./', '_', $name );
    
        if ( 'showdate_check' == $name )
            $output = get_post_meta($post->ID,showdate,true);
        if ( 'showplace_check' == $name )
            $output = get_post_meta($post->ID,showplace,true);
        return $output;
    
    }
1件の返信を表示中 - 1 - 1件目 (全1件中)
  • トピック「TimeTurnerのfunctions.phpについて」には新たに返信することはできません。