文件操作 - functions.php
返回文件管理
返回主菜单
删除本文件
文件: /storage/v12552/jimbrandstatter/public_html/wp-content/themes/total-child-theme/functions.php
编辑文件内容
<?php /** * Child theme functions * * When using a child theme (see http://codex.wordpress.org/Theme_Development * and http://codex.wordpress.org/Child_Themes), you can override certain * functions (those wrapped in a function_exists() call) by defining them first * in your child theme's functions.php file. The child theme's functions.php * file is included before the parent theme's file, so the child theme * functions would be used. * * Text Domain: wpex * @link http://codex.wordpress.org/Plugin_API * */ /** * Load the parent style.css file * * @link http://codex.wordpress.org/Child_Themes */ function total_child_enqueue_parent_theme_style() { wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css', array(), WPEX_THEME_VERSION ); } add_action( 'wp_enqueue_scripts', 'total_child_enqueue_parent_theme_style' ); add_filter( 'gform_field_value_refurl', 'populate_referral_url'); function populate_referral_url( $form ){ // Grab URL from HTTP Server Var and put it into a variable $refurl = $_SERVER['HTTP_REFERER']; GFCommon::log_debug( __METHOD__ . "(): HTTP_REFERER value returned by the server: {$refurl}" ); // Return that value to the form return esc_url_raw($refurl); } function check_for_match($check = [], $in = "") { foreach ($check as $val) : if (strstr($in, $val)) { return true; } endforeach; return false; } function add_lead_source_tracking() { if (!isset($_COOKIE["lead_sess_source"])) { $sess_landing = $_SERVER['REQUEST_URI']; $sess_referer = $_SERVER['HTTP_REFERER']; $sess_cookies = [ "referer" => $sess_referer, "landing" => $sess_landing ]; $lead_source = "MANUAL"; $ppc_matches_land = [ "aclk?", "ads?", "ads/i/iframe", "g.doubleclick", "trackppc", "utm_source=ppc", "utm_medium=ppc" ]; $ppc_matches_ref = [ "gclid=", "trackppc" ]; $organic_matches = [ "google", "GMB", "utm_medium=organic", "yahoo", "bing", "ask.com", "searchlock.com", "duckduckgo", "baidu" ]; $social_matches = [ "twitter.com", "t.co", "facebook.com", "fb.me", "linkedin.com", "lnkd.in", "quora.com", "pinterest.com", "reddit.com", "instagram.com", "myspace.com", "digg.com" ]; if ($sess_cookies["referer"] || $sess_cookies["landing"]) : if ( (strstr($sess_cookies["landing"], "gclid=") && strstr($sess_cookies["landing"], "google.com")) || (strstr($sess_cookies["landing"], "aclk=") && strstr($sess_cookies["landing"], "google.com")) || check_for_match($ppc_matches_land, $sess_cookies["landing"]) || (check_for_match($ppc_matches_ref, $sess_cookies["referer"])) ) : $lead_source = "PPC"; else : if (check_for_match($organic_matches, $sess_cookies["referer"]) || strstr( $sess_cookies["landing"], "utm_medium=organic" )) : $lead_source = "Organic"; elseif (check_for_match($social_matches, $sess_cookies["referer"])) : $lead_source = "Social"; elseif ($sess_cookies["referer"]) : $lead_source = "Referring Website"; else : $lead_source = "Direct"; endif; endif; else : $lead_source = "Direct"; endif; setcookie("lead_sess_source", urldecode($lead_source), time() + (60 * 60 * 24 * 7)); } } add_action('wp_footer', 'add_lead_source_tracking'); add_filter('gform_pre_process', 'change_notifications', 10, 1); function change_notifications($form) { $display_lead_source = false; $lead_source_id = ""; foreach ($form["fields"] as $key => $val) : if ($val->inputName == "lead_source") : $display_lead_source = true; $lead_source_id = "input_" . $val->id; endif; endforeach; if ($display_lead_source) : $_POST[$lead_source_id] = $_COOKIE["lead_sess_source"]; endif; return $form; } /**function add_footprint_tracking() { echo '<script async src="//awsstatreporter.com/tracker.js"></script>'; } add_action('wp_footer', 'add_footprint_tracking'); // Function written by Nathan Gravity Forms to Footprint add_action( 'gform_after_submission', 'after_submission', 10, 2 ); function after_submission($entryObj, $formObj){ // GA curl $req = curl_init('https://www.google-analytics.com/collect'); $params = [ 'v' => 1, 't' => 'event', 'tid' => 'UA-98520949-1', 'cid' => '591443370.1628259893', 'ec' => 'Lead Form', 'ea' => 'Submit', 'el' => $formObj['title'] ]; $post_data = http_build_query($params); curl_setopt_array($req, array( CURLOPT_POST => TRUE, CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_POSTFIELDS => $post_data )); // Send the request $response = curl_exec($req); } //for the source splitting function check_for_match($check=[], $in="") { foreach ($check as $val): if (strstr($in, $val)) { return true; } endforeach; return false; } **/ // Alter the page header title arguments add_filter( 'wpex_page_header_title_args', function( $args ) { $args['html_tag'] = 'div'; return $args; }, 40 );
修改文件时间
将文件时间修改为当前时间的前一年
删除文件