code in functions.php not restricting or behaving as it should be

I have written the below script to restrict users to access bbpress forums or topics. Here are the conditions:

  1. If user in not logged in will be redirected to “Join” page.
  2. If user is logged in but doesn’t have “pmpro_role_1” role, he will be redirected to “Product Page”.
  3. If a user is the administrator, he can view the page.

The problem here is for topics in forum it is working except the latest created topic. And it is taking user to “Join” page even if the user is logged in and have the “pmpro_role_1”. What is happening here?

Please help.

    add_action ('template_redirect', 'forum_security');          function forum_security(){         $  roles = wp_get_current_user()-> roles;         if(is_singular( array( 'forum', 'topic' ) )){             if(!is_user_logged_in()){                 wp_redirect('/join');                 exit;             }else{                 if(current_user_can('administrator')){                     return;                 }elseif(!in_array('pmpro_role_1', $  roles)){                     wp_redirect('/product/channel-mcgilchrist');                     exit;                 }             }                      }     } 

Child theme functions.php is not executing

WordPress + WooCoomerce + Storefront theme + Storefront child theme.

I have the child theme’s functions.php file from previous site development iteration which used to work. After migrating to new hosting I set up from the scratch same set of WordPress + WooCoomerce + Storefront theme + made Storefront child theme. The only diference with previous iteration is set of plug-ins and CSS rules/styling but custom code in functions.php is not touching them at all. Hoever then I copied functions.php from the previous site iteration it seems to be not executed at all. Trying to fix that I plaied a bit with file permissions on OS level: now it is set to rwxrwxrwx (I know it is not safe but I totaly run out of ideas of what is happening)

What might be going wrong with functions.php?

Here goes the functions.php contents

<?php // Exit if accessed directly if ( !defined( 'ABSPATH' ) ) exit;   // BEGIN ENQUEUE PARENT ACTION // AUTO GENERATED - Do not modify or remove comment markers above or below:  if ( !function_exists( 'chld_thm_cfg_locale_css' ) ):     function chld_thm_cfg_locale_css( $  uri ){         if ( empty( $  uri ) && is_rtl() && file_exists( get_template_directory() . '/rtl.css' ) )             $  uri = get_template_directory_uri() . '/rtl.css';         return $  uri;     } endif; add_filter( 'locale_stylesheet_uri', 'chld_thm_cfg_locale_css' );           if ( !function_exists( 'child_theme_configurator_css' ) ):     function child_theme_configurator_css() {         wp_enqueue_style( 'chld_thm_cfg_separate', trailingslashit( get_stylesheet_directory_uri() ) . 'ctc-style.css', array( 'storefront-gutenberg-blocks','storefront-style','storefront-style','storefront-icons','storefront-jetpack-widgets','storefront-woocommerce-style' ) );     } endif; add_action( 'wp_enqueue_scripts', 'child_theme_configurator_css', 30 );  // END ENQUEUE PARENT ACTION   add_filter( 'storefront_credit_link', '__return_false' );   add_filter( 'woocommerce_variable_price_html', 'variation_price', 20, 2 );  function variation_price( $  price, $  product ) {       $  min_regular_price = $  product->get_variation_regular_price( 'min', true );     $  min_sale_price = $  product->get_variation_sale_price( 'min', true );     $  max_regular_price = $  product->get_variation_regular_price( 'max', true );     $  max_sale_price = $  product->get_variation_sale_price( 'max', true );       if ( ! ( $  min_regular_price == $  max_regular_price && $  min_sale_price == $  max_sale_price ) ) {         if ( $  min_sale_price < $  min_regular_price ) {             $  price = sprintf( '<span>from </span><del>%1$  s</del><ins>%2$  s</ins>', wc_price( $  min_regular_price ), wc_price( $  min_sale_price ) );         } else {             $  price = sprintf( '<span>from </span>%1$  s', wc_price( $  min_regular_price ) );         }     }       return $  price;   }   function short_woocommerce_product_titles_words( $  title, $  id ) {   if ( ( is_shop() || is_product_tag() || is_product_category() ) && get_post_type( $  id ) === 'product' ) {     $  title_words = explode(" ", $  title);     if ( count($  title_words) > 6 ) { // Kicks in if the product title is longer than 6 words       // Shortens the title to 6 words and adds ellipsis at the end       return implode(" ", array_slice($  title_words, 0, 6)) . '...';     } else {       return $  title; // If the title isn't longer than 6 words, it will be returned in its full length without the ellipsis     }   } else {     return $  title;   } } add_filter( 'the_title', 'short_woocommerce_product_titles_words', 10, 2 );   remove_action( 'storefront_header', 'storefront_product_search', 40); add_action( 'storefront_header', 'storefront_product_search', 25 ); 

Move custom code out of theme’s functions.php file

I have written code to use on a single page, but I’ve placed it in the theme’s functions.php and created a javascript file and placed it in the theme’s JS directory.

Recently, the theme was updated and functions.php was overwritten and JS file disappeared.

Where do I need to put this code so when the theme is updated, my code will not be lost?

functions.php:

 add_action('wp_ajax_zip_search', 'zip_search'); add_action('wp_ajax_nopriv_zip_search', 'zip_search' ); function zip_search() {     global $  wpdb;      $  zip = $  _REQUEST["zip_code"];      /**/      $  query = 'SELECT zone FROM Counties WHERE zip = %s';     $  zone = $  wpdb->get_var( $  wpdb->prepare($  query, $  zip) );      $  output = "<h1>".$  zone."</h1>";     $  t_zone = $  zone;     $  trimmed_zone = trim($  t_zone);      $  query = 'SELECT * FROM Managers WHERE zone = %s;';     $  manager_info = $  wpdb->get_row(  $  wpdb->prepare($  query, $  trimmed_zone) );      $  output .= "<table style=\"width:100%\">" .                      "<tr>".                         "<th>Zone Manager</th>".                         "<th>Phone</th>".                         "<th>Email Address</th>".                     "</tr>" .                     "<tr>" .                          "<td>" . $  manager_info->first_name . " " . $  manager_info->last_name  . "</td>" .                          "<td>" . $  manager_info->phone_number . "</td>" .                          "<td>" . $  manager_info->email_address .  "</td>" .                      "</tr>" .                 "</table>";      $  query = 'SELECT Region_Number FROM Zones WHERE Zone = %s';     $  region = $  wpdb->get_var( $  wpdb->prepare($  query, $  zone) );      $  query = 'SELECT * FROM Agblist WHERE Region_Number = %s';     $  results = $  wpdb->get_results( $  wpdb->prepare($  query, $  region) );          $  output .= "<table style=\"width:100%\">";          $  output .= "<tr>".                 "<th>Company Name</th>".                 "<th>Contact Info</th>".                 "<th>Channel</th>".                 "<th>Territory</th>".                "</tr>";      foreach( $  results as $  result )      {         $  output .= "<tr>".                         "<td>".$  result->Company_Name."</td>".                         "<td>".$  result->Corp_Address_Line_1."</br>".$  result->Corp_Address_Line_2."</br>".$  result->Corp_City.", ".$  result->Corp_State." ".$  result->Corp_Zip_Code."</br>".$  result->Office_Phone_1."</td>".                         "<td>".$  result->Channel."</td>".                         "<td>".$  result->Agent_Territory."</td>".                     "</tr>";     }     //$  output .= "<li>Result: ".$  results."</li>";     $  output .= "</table>"; /**/     //$  output = "<p>here</p>";     $  response = array(         'data' => $  output,     );      wp_send_json_success($  response); }  add_action( 'wp_enqueue_scripts', 'my_load_scripts' ); function my_load_scripts() {      // Enqueue javascript on the frontend.     wp_enqueue_script(         'zip_js',         get_template_directory_uri() . '/js/zip_search.js',         array('jquery')     );      // The wp_localize_script allows us to output the ajax_url path for our script to use.     wp_localize_script(         'zip_js',         'myAjax',         array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) )     );  } 

/js/zip_search.js:

jQuery(document).ready( function() {    console.log("Document loaded!");    jQuery("#AgentSearchButton").click( function(e) {       console.log("Search button clicked");       e.preventDefault();        var zipCode = document.getElementById("AgentInputField").value;       console.log("Zip code entered: " + zipCode);       jQuery.ajax({          type : "post",          dataType : "json",          url : myAjax.ajaxurl,          data : {              'action': "zip_search",              'zip_code' : zipCode          },          success: function(response) {             console.log(response.data);             if(response.success) {                 console.log("response.type == success");                 jQuery("#results").html(response.data.data);             }             else {                 console.log("response.type == else");                 console.log(response.data);             }          },         error: function(errorThrown){             console.log("In error, error thrown!");             console.log(errorThrown);         }       })    }) }); 

Validate functions before inserting then into functions.php

I’d like to know if the functions below follow best practices in terms of ensuring the best performance and security before deploying to the main site.

1. Remove paged category description

add_action( 'wp', 'tu_remove_paged_category_description' ); function tu_remove_paged_category_description() {     $  page = (get_query_var('paged')) ? get_query_var('paged') : 1;     if ( 1 !== $  page ) {         remove_action( 'generate_archive_title', 'generate_archive_title' );         add_action( 'generate_archive_title', 'tu_custom_paged_archive_title' );     } }  function tu_custom_paged_archive_title() {     ?>     <header class="page-header">         <h1 class="page-title">             <?php the_archive_title(); ?>         </h1>     </header>     <?php } 

2. Allow HTML editing of author biography

remove_filter('pre_user_description', 'wp_filter_kses');   add_filter( 'pre_user_description', 'wp_filter_post_kses' ); 

3. Limit number of posts on first page of selected categories

add_action( 'pre_get_posts', function( $  query ) {     if ( ! is_main_query() || is_admin() ) {         return;     }     if ( ! is_paged() && is_category(array (2 , 3) )) {         $  query->set( 'posts_per_page', 8 );     } } ); 

4. prevent the category widget from using the category description as the list item title attribute

function mbf_disable_cat_desc_widget_list_titles ( $  cat_args ) {     $  cat_args[ 'use_desc_for_title' ] = 0;     return $  cat_args; } add_filter( 'widget_categories_args', 'mbf_disable_cat_desc_widget_list_titles' ); 

5. Create shortcode by listing subcategories belonging to that category

function mbf_subcategories($  atts, $  content = null ){extract(shortcode_atts(array('count'=>'10','show_count' =>0,'hide_empty'=>0), $  atts)); $  parents = array(); if(is_category())   { //If on a Category Archive Page, show its subcategories, if any         $  cat = get_category(get_query_var('cat'), false);         $  id = ($  cat->category_parent==0)? $  cat->cat_ID : $  cat->category_parent;          if (get_term_children($  id, 'category') != "") {         //List of subcategories with parent category in title.             $  args =( array('show_option_none'=>'','title_li' => '','echo'=>0,'show_count'=> $  show_count,'number' => $  count,'hide_empty'=>$  hide_empty,'child_of'=>$  id));              $  output = '<ol>'.wp_list_categories($  args).'</ol>';          }     }     return $  output; } add_shortcode('mbf_subcategories', 'mbf_subcategories'); 

¿Como hacer una llamada AJAX distinta al servidor (función PHP en functions.php) según valor de la opción seleccionada en un select?

En este ejemplo Tengo 1 Select con 2 opciones ‘UpToBox’ y ‘Mega’ que cuando seleccione alguna de las dos opciones se realice una llamada mediante AJAX (action) al Backend (PHP de functions.php) que ejecuta los métodos ‘generatelinks_mega’ ó ‘generatelinks_uptobox’ respectivamente según lo elegido. Intenté hacerlo leyendo en muchos sitios y tratando de adaptar el código según mis necesidades específicas, pero esto no funciona.

¿Cómo logro esto?. Si alguien pudiera echarme una buena mano para hacerlo funcionar, estaría agradecido.

Código HTML (Single.php)

<section id="Enlaces22" style="text-align:center; margin: 0 0 0 0; padding:0 0 0 0;">         <select id="mySelect">         <option value="UptoBox">UptoBox</option>         <option value="Mega">Mega</option>         </select>         <br/>         <span id="iselected"></span>         </section>

Javascript (capture-script.js)

(function($  ){      var $  mySelect = $  ('#mySelect');     var $  selected = $  ('#iselected');      $  mySelect.change(function(){       var selectedOption = $  (this).find('option:selected');       var selectedLabel = $  selectedOption.text();       var selectedValue = $  selectedOption.val();       //$  selected.text(selectedValue + ' - ' + selectedLabel);       switch ($  selectedLabel) {       case 'UptoBox' :       $  .ajax({         url: pk_vars.ajaxurl,         type: 'post',         data: {             action: 'generatelinks_uptobox',         },         beforeSend: function(){           $  selected.text('Cargando ...');         },         success: function(resultado){             $  selected.text(resultado);         }       });       break;       case 'Mega' :       $  .ajax({         url: pk_vars.ajaxurl,         type: 'post',         data: {             action: 'generatelinks_mega',         },         beforeSend: function(){           $  selected.text('Cargando ...');         },         success: function(resultado){             $  selected.text(resultado);         }       });       break;     };  });  })(jQuery);

Adding customizer options to functions.php breaks the customizer panel

I created a big set of customizer options using this generator here https://dev.lws-webdesign.de/generator/customizer-v3/. It saved me a lot of time, but I can’t figure out what’s going on. It makes the customizer panel show only one section,”Widget”, and nothing more.

    function wpc_customize_register( $  wp_customize ) {      // Create our panels      $  wp_customize->add_panel( 'wpc_header', array(         'title'          => 'Header',         'description'    => 'Adjust your header options',     ) );      $  wp_customize->add_panel( 'wpc_home', array(         'title'          => 'Home Page',         'description'    => 'Add content to your Home page The home page is divided by sections and each section contains headings and texts',     ) );      $  wp_customize->add_panel( 'wpc_about', array(         'title'          => 'About Us Page',         'description'    => 'Add content to your About Us page This page is divided by sections and each section contains headings and texts IMPORTANT You first need to add a new page by going to your WordPress admin area  click on Pages  Add New  enter a title  go to page attributes section  select About in the Parent option  Publish your page',     ) );      $  wp_customize->add_panel( 'wpc_portfolio', array(         'title'          => 'Portfolio Page',         'description'    => 'Here you can add images of your previous works or your clients logo IMPORTANT You first need to add a new page by going to your WordPress admin area  click on Pages  Add New  enter a title  go to page attributes section  select Portfolio in the Parent option  Publish your page',     ) );      $  wp_customize->add_panel( 'wpc_services', array(         'title'          => 'Services',         'description'    => 'Describe your business area your expertise etc IMPORTANT You first need to add a new page by going to your WordPress admin area  click on Pages  Add New  enter a title  go to page attributes section  select Services in the Parent option  Publish your page',     ) );      $  wp_customize->add_panel( 'wpc_contact', array(         'title'          => 'Contact Page',         'description'    => 'IMPORTANT You first need to add a new page by going to your WordPress admin area  click on Pages  Add New  enter a title  go to page attributes section  select Contact in the Parent option  Publish your page',     ) );      $  wp_customize->add_panel( 'wpc_footer', array(         'title'          => 'Footer',         'description'    => 'Adjust your footer options',     ) );      // Create our sections      $  wp_customize->add_section( 'wpc_header_contact' , array(         'title'             => 'Contact information',         'description'       => 'Tell your visitors how they can contact you',         'panel'             => 'wpc_header',     ) );      $  wp_customize->add_section( 'wpc_header_headlines' , array(         'title'             => 'Headlines',         'description'       => 'Add headlines and captions that grabs your visitors attention',         'panel'             => 'wpc_header',     ) );      $  wp_customize->add_section( 'wpc_home_section1' , array(         'title'             => 'Section 1',         'panel'             => 'wpc_home',     ) );      $  wp_customize->add_section( 'wpc_home_section2' , array(         'title'             => 'Section 2',         'panel'             => 'wpc_home',     ) );      $  wp_customize->add_section( 'wpc_home_section3' , array(         'title'             => 'Section 3',         'panel'             => 'wpc_home',     ) );      $  wp_customize->add_section( 'wpc_home_section4' , array(         'title'             => 'Section 4',         'panel'             => 'wpc_home',     ) );      $  wp_customize->add_section( 'wpc_about_section1' , array(         'title'             => 'Section 1',         'panel'             => 'wpc_about',     ) );      $  wp_customize->add_section( 'wpc_about_section2' , array(         'title'             => 'Section 2',         'description'       => 'Here you can add information about your team members',         'panel'             => 'wpc_about',     ) );      $  wp_customize->add_section( 'wpc_portfolio_add' , array(         'title'             => 'Add Itens',         'description'       => 'A title should be short and describe what an image is about',         'panel'             => 'wpc_portfolio',     ) );      $  wp_customize->add_section( 'wpc_services_section1' , array(         'title'             => 'Section 1',         'panel'             => 'wpc_services',     ) );      $  wp_customize->add_section( 'wpc_services_section2' , array(         'title'             => 'Section 2',         'description'       => 'This section contains four boxes where you can highlight features or anything else Headings must be shorter as possible as well as descriptions',         'panel'             => 'wpc_services',     ) );      $  wp_customize->add_section( 'wp_contact_section1' , array(         'title'             => 'Section 1',         'description'       => 'Add a heading and some text to your contact page Heading example Wed Love to Hear From You Lets Get In Touch',         'panel'             => 'wpc_contact',     ) );      $  wp_customize->add_section( 'wpc_contact_section2' , array(         'title'             => 'Section 2',         'panel'             => 'wpc_contact',     ) );      $  wp_customize->add_section( 'wpc_footer_about' , array(         'title'             => 'A Little About You Business',         'description'       => 'This section is perfect for you to tell a little about yourself or your business A 500-600 characters text would be perfect',         'panel'             => 'wpc_footer',     ) );      $  wp_customize->add_section( 'wpc_footer_contact' , array(         'title'             => 'Contact Information',         'description'       => 'Tell your visitors how they can contact you',         'panel'             => 'wpc_footer',     ) );      $  wp_customize->add_section( 'wpc_contact_social' , array(         'title'             => 'Social Networks',         'panel'             => 'wpc_contact',     ) );      // Create our settings      $  wp_customize->add_setting( 'wpc_header_contact_display_phone' , array(         'type'          => 'theme_mod',         'transport'     => 'refresh',     ) );     $  wp_customize->add_control( 'wpc_header_contact_display_phone_control', array(         'label'      => 'Display Phone Icon',         'section'    => 'wpc_header_contact',         'settings'   => 'wpc_header_contact_display_phone',         'type'       => 'checkbox',             'choices'    => array(                'header_phone' => 'fa fa-lg fa-phone',             ),     ) );      $  wp_customize->add_setting( 'wpc_header_contact_display_twitter' , array(         'type'          => 'theme_mod',         'transport'     => 'refresh',     ) );     $  wp_customize->add_control( 'wpc_header_contact_display_twitter_control', array(         'label'      => 'Display Twitter Icon',         'section'    => 'wpc_header_contact',         'settings'   => 'wpc_header_contact_display_twitter',         'type'       => 'checkbox',             'choices'    => array(                'header_twitter' => 'fa fa-lg fa-twitter',             ),     ) );      $  wp_customize->add_setting( 'wpc_header_contact_display_facebook' , array(         'type'          => 'theme_mod',         'transport'     => 'refresh',     ) );     $  wp_customize->add_control( 'wpc_header_contact_display_facebook_control', array(         'label'      => 'Display Facebook Icon',         'section'    => 'wpc_header_contact',         'settings'   => 'wpc_header_contact_display_facebook',         'type'       => 'checkbox',             'choices'    => array(                'header_facebook' => 'fa fa-lg fa-facebook',             ),     ) );      $  wp_customize->add_setting( 'wpc_header_contact_display_instagram' , array(         'type'          => 'theme_mod',         'transport'     => 'refresh',     ) );     $  wp_customize->add_control( 'wpc_header_contact_display_instagram_control', array(         'label'      => 'Display Instagram Icon',         'section'    => 'wpc_header_contact',         'settings'   => 'wpc_header_contact_display_instagram',         'type'       => 'checkbox',             'choices'    => array(                'header_instagram' => 'fa fa-lg fa-instagram',             ),     ) );      $  wp_customize->add_setting( 'wpc_header_contact_phone' , array(         'type'          => 'theme_mod',         'transport'     => 'refresh',     ) );     $  wp_customize->add_control( 'wpc_header_contact_phone_control', array(         'label'      => 'Phone Number',         'description'=> 'Type your phone number',         'section'    => 'wpc_header_contact',         'settings'   => 'wpc_header_contact_phone',         'type'       => 'text',     ) );      $  wp_customize->add_setting( 'wp_header_contact_twitter' , array(         'type'          => 'theme_mod',         'transport'     => 'refresh',     ) );     $  wp_customize->add_control( 'wp_header_contact_twitter_control', array(         'label'      => 'Twitter Profile',         'description'=> 'Type your twitter profile link',         'section'    => 'wpc_header_contact',         'settings'   => 'wp_header_contact_twitter',         'type'       => 'text',     ) );      $  wp_customize->add_setting( 'wpc_header_contact_facebook' , array(         'type'          => 'theme_mod',         'transport'     => 'refresh',     ) );     $  wp_customize->add_control( 'wpc_header_contact_facebook_control', array(         'label'      => 'Facebook Profile',         'description'=> 'Type your facebook profile link',         'section'    => 'wpc_header_contact',         'settings'   => 'wpc_header_contact_facebook',         'type'       => 'text',     ) );      $  wp_customize->add_setting( 'wpc_header_contact_instagram' , array(         'type'          => 'theme_mod',         'transport'     => 'refresh',     ) );     $  wp_customize->add_control( 'wpc_header_contact_instagram_control', array(         'label'      => 'Instagram Profile',         'description'=> 'Type your instagram profile link',         'section'    => 'wpc_header_contact',         'settings'   => 'wpc_header_contact_instagram',         'type'       => 'text',     ) );      $  wp_customize->add_setting( 'wpc_header_headline1' , array(         'type'          => 'theme_mod',         'transport'     => 'refresh',     ) );     $  wp_customize->add_control( 'wpc_header_headline1_control', array(         'label'      => 'Headline 1',         'section'    => 'wpc_header_headline',         'settings'   => 'wpc_header_headline1',         'type'       => 'text',     ) );      $  wp_customize->add_setting( 'wpc_header_headline1_caption' , array(         'type'          => 'theme_mod',         'transport'     => 'refresh',     ) );     $  wp_customize->add_control( 'wpc_header_headline1_caption_control', array(         'label'      => 'Caption for headline 1',         'section'    => 'wpc_header_headline',         'settings'   => 'wpc_header_headline1_caption',         'type'       => 'text',     ) );      $  wp_customize->add_setting( 'wpc_header_headline2' , array(         'type'          => 'theme_mod',         'transport'     => 'refresh',     ) );     $  wp_customize->add_control( 'wpc_header_headline2_control', array(         'label'      => 'Headline 2',         'section'    => 'wpc_header_headline',         'settings'   => 'wpc_header_headline2',         'type'       => 'text',     ) );      $  wp_customize->add_setting( 'wpc_header_headline2_caption' , array(         'type'          => 'theme_mod',         'transport'     => 'refresh',     ) );     $  wp_customize->add_control( 'wpc_header_headline2_caption_control', array(         'label'      => 'Caption for headline 2',         'section'    => 'wpc_header_headline',         'settings'   => 'wpc_header_headline2_caption',         'type'       => 'text',     ) );      $  wp_customize->add_setting( 'wpc_header_headline3' , array(         'type'          => 'theme_mod',         'transport'     => 'refresh',     ) );     $  wp_customize->add_control( 'wpc_header_headline3_control', array(         'label'      => 'Headline 3',         'section'    => 'wpc_header_headline',         'settings'   => 'wpc_header_headline3',         'type'       => 'text',     ) );      $  wp_customize->add_setting( 'wpc_home_section1_heading' , array(         'type'          => 'theme_mod',         'transport'     => 'refresh',     ) );     $  wp_customize->add_control( 'wpc_home_section1_heading_control', array(         'label'      => 'Heading',         'section'    => 'wpc_home_section1',         'settings'   => 'wpc_home_section1_heading',         'type'       => 'text',     ) );      $  wp_customize->add_setting( 'wpc_home_section1_text' , array(         'type'          => 'theme_mod',         'transport'     => 'refresh',     ) );     $  wp_customize->add_control( 'wpc_home_section1_text_control', array(         'label'      => 'Text',         'section'    => 'wpc_home_section1',         'settings'   => 'wpc_home_section1_text',         'type'       => 'textarea',     ) );      $  wp_customize->add_setting( 'wpc_home_section1_image' , array(         'type'          => 'theme_mod',         'transport'     => 'refresh',     ) );     $  wp_customize->add_control( 'wpc_home_section1_image_control', array(         'label'      => 'Image',         'section'    => 'wpc_home_section1',         'settings'   => 'wpc_home_section1_image',         'type'       => 'image',     ) );      $  wp_customize->add_setting( 'wpc_home_section2_heading' , array(         'type'          => 'theme_mod',         'transport'     => 'refresh',     ) );     $  wp_customize->add_control( 'wpc_home_section2_heading_control', array(         'label'      => 'Heading',         'section'    => 'wpc_home_section2',         'settings'   => 'wpc_home_section2_heading',         'type'       => 'text',     ) );      $  wp_customize->add_setting( 'wpc_home_section2_text' , array(         'type'          => 'theme_mod',         'transport'     => 'refresh',     ) );     $  wp_customize->add_control( 'wpc_home_section2_text_control', array(         'label'      => 'Text',         'section'    => 'wpc_home_section2',         'settings'   => 'wpc_home_section2_text',         'type'       => 'textarea',     ) );      $  wp_customize->add_setting( 'wpc_home_section2_image' , array(         'type'          => 'theme_mod',         'transport'     => 'refresh',     ) );     $  wp_customize->add_control( 'wpc_home_section2_image_control', array(         'label'      => 'Image',         'section'    => 'wpc_home_section2',         'settings'   => 'wpc_home_section2_image',         'type'       => 'image',     ) );      $  wp_customize->add_setting( 'wpc_home_section3_heading_area1' , array(         'type'          => 'theme_mod',         'transport'     => 'refresh',     ) );     $  wp_customize->add_control( 'wpc_home_section3_heading_area1_control', array(         'label'      => 'Heading area 1',         'section'    => 'wpc_home_section3',         'settings'   => 'wpc_home_section3_heading_area1',         'type'       => 'text',     ) );      $  wp_customize->add_setting( 'wpc_home_section3_text_area1' , array(         'type'          => 'theme_mod',         'transport'     => 'refresh',     ) );     $  wp_customize->add_control( 'wpc_home_section3_text_area1_control', array(         'label'      => 'Text area 1',         'section'    => 'wpc_home_section3',         'settings'   => 'wpc_home_section3_text_area1',         'type'       => 'textarea',     ) );      $  wp_customize->add_setting( 'wpc_home_section3_heading_area2' , array(         'type'          => 'theme_mod',         'transport'     => 'refresh',     ) );     $  wp_customize->add_control( 'wpc_home_section3_heading_area2_control', array(         'label'      => 'Heading area 2',         'section'    => 'wpc_home_section3',         'settings'   => 'wpc_home_section3_heading_area2',         'type'       => 'text',     ) );      $  wp_customize->add_setting( 'wpc_home_section3_text_area2' , array(         'type'          => 'theme_mod',         'transport'     => 'refresh',     ) );     $  wp_customize->add_control( 'wpc_home_section3_text_area2_control', array(         'label'      => 'Text area 2',         'section'    => 'wpc_home_section3',         'settings'   => 'wpc_home_section3_text_area2',         'type'       => 'textarea',     ) );      $  wp_customize->add_setting( 'wpc_home_section4_heading' , array(         'type'          => 'theme_mod',         'transport'     => 'refresh',     ) );     $  wp_customize->add_control( 'wpc_home_section4_heading_control', array(         'label'      => 'Main Heading',         'section'    => 'wpc_home_section4',         'settings'   => 'wpc_home_section4_heading',         'type'       => 'text',     ) );      $  wp_customize->add_setting( 'wpc_home_section4_heading_area1' , array(         'type'          => 'theme_mod',         'transport'     => 'refresh',     ) );     $  wp_customize->add_control( 'wpc_home_section4_heading_area1_control', array(         'label'      => 'Heading area 1',         'section'    => 'wpc_home_section4',         'settings'   => 'wpc_home_section4_heading_area1',         'type'       => 'text',     ) );      $  wp_customize->add_setting( 'wpc_home_section4_text_area1' , array(         'type'          => 'theme_mod',         'transport'     => 'refresh',     ) );     $  wp_customize->add_control( 'wpc_home_section4_text_area1_control', array(         'label'      => 'Text area 1',         'section'    => 'wpc_home_section4',         'settings'   => 'wpc_home_section4_text_area1',         'type'       => 'textarea',     ) ); $  wp_customize->add_setting( 'wpc_home_section4_heading_area1' , array(     'type'          => 'theme_mod',     'transport'     => 'refresh', ) ); $  wp_customize->add_control( 'wpc_home_section4_heading_area1_control', array(     'label'      => 'Heading area 2',     'section'    => 'wpc_home_section4',     'settings'   => 'wpc_home_section4_heading_area1',     'type'       => 'text', ) );  $  wp_customize->add_setting( 'wpc_home_section4_text_area2' , array(     'type'          => 'theme_mod',     'transport'     => 'refresh', ) ); $  wp_customize->add_control( 'wpc_home_section4_text_area2_control', array(     'label'      => 'Text area 2',     'section'    => 'wpc_home_section4',     'settings'   => 'wpc_home_section4_text_area2',     'type'       => 'textarea', ) );  $  wp_customize->add_setting( 'wpc_about_section1_heading' , array(     'type'          => 'theme_mod',     'transport'     => 'refresh', ) ); $  wp_customize->add_control( 'wpc_about_section1_heading_control', array(     'label'      => 'Heading',     'section'    => 'wpc_about_section1',     'settings'   => 'wpc_about_section1_heading',     'type'       => 'text', ) );  $  wp_customize->add_setting( 'wpc_about_section1_text' , array(     'type'          => 'theme_mod',     'transport'     => 'refresh', ) ); $  wp_customize->add_control( 'wpc_about_section1_text_control', array(     'label'      => 'Text',     'section'    => 'wpc_about_section1',     'settings'   => 'wpc_about_section1_text',     'type'       => 'textarea', ) );  $  wp_customize->add_setting( 'wpc_about_section1_image' , array(     'type'          => 'theme_mod',     'transport'     => 'refresh', ) ); $  wp_customize->add_control( 'wpc_about_section1_image_control', array(     'label'      => 'Image',     'section'    => 'wpc_about_section1',     'settings'   => 'wpc_about_section1_image',     'type'       => 'image', ) );  $  wp_customize->add_setting( 'wpc_about_section2_heading' , array(     'type'          => 'theme_mod',     'transport'     => 'refresh', ) ); $  wp_customize->add_control( 'wpc_about_section2_heading_control', array(     'label'      => 'Heading',     'description'=> 'eg Meet Our Team',     'section'    => 'wpc_about_section2',     'settings'   => 'wpc_about_section2_heading',     'type'       => 'text', ) );  $  wp_customize->add_setting( 'wpc_about_section2_member1_picture' , array(     'type'          => 'theme_mod',     'transport'     => 'refresh', ) ); $  wp_customize->add_control( 'wpc_about_section2_member1_picture_control', array(     'label'      => 'Member 1 Picture',     'section'    => 'wpc_about_section2',     'settings'   => 'wpc_about_section2_member1_picture',     'type'       => 'image', ) );  $  wp_customize->add_setting( 'wpc_about_section2_member1_name' , array(     'type'          => 'theme_mod',     'transport'     => 'refresh', ) ); $  wp_customize->add_control( 'wpc_about_section2_member1_name_control', array(     'label'      => 'Member 1 Name',     'section'    => 'wpc_about_section2',     'settings'   => 'wpc_about_section2_member1_name',     'type'       => 'text', ) );  $  wp_customize->add_setting( 'wpc_about_section2_member1_job' , array(     'type'          => 'theme_mod',     'transport'     => 'refresh', ) ); $  wp_customize->add_control( 'wpc_about_section2_member1_job_control', array(     'label'      => 'Member 1 Job Title',     'section'    => 'wpc_about_section2',     'settings'   => 'wpc_about_section2_member1_job',     'type'       => 'text', ) );  $  wp_customize->add_setting( 'wpc_portfolio_add_image1' , array(     'type'          => 'theme_mod',     'transport'     => 'refresh', ) ); $  wp_customize->add_control( 'wpc_portfolio_add_image1_control', array(     'label'      => 'Image 1',     'section'    => 'wpc_portfolio_add',     'settings'   => 'wpc_portfolio_add_image1',     'type'       => 'image', ) );  $  wp_customize->add_setting( 'wpc_portfolio_add_image1_title' , array(     'type'          => 'theme_mod',     'transport'     => 'refresh', ) ); $  wp_customize->add_control( 'wpc_portfolio_add_image1_title_control', array(     'label'      => 'Image 1 Title',     'section'    => 'wpc_portifolio_add',     'settings'   => 'wpc_portfolio_add_image1_title',     'type'       => 'text', ) );  $  wp_customize->add_setting( 'wpc_services_section2_box1_heading' , array(     'type'          => 'theme_mod',     'transport'     => 'refresh', ) ); $  wp_customize->add_control( 'wpc_services_section2_box1_heading_control', array(     'label'      => 'Box 1 Heading',     'section'    => 'wpc_services_section2',     'settings'   => 'wpc_services_section2_box1_heading',     'type'       => 'text', ) );  $  wp_customize->add_setting( 'wpc_services_section2_box1_description' , array(     'type'          => 'theme_mod',     'transport'     => 'refresh', ) ); $  wp_customize->add_control( 'wpc_services_section2_box1_description_control', array(     'label'      => 'Box 1 Description',     'section'    => 'wpc_services_section2',     'settings'   => 'wpc_services_section2_box1_description',     'type'       => 'textarea', ) );  $  wp_customize->add_setting( 'wpc_contact_section1_heading' , array(     'type'          => 'theme_mod',     'transport'     => 'refresh', ) ); $  wp_customize->add_control( 'wpc_contact_section1_heading_control', array(     'label'      => 'Heading',     'section'    => 'wpc_contact_section1',     'settings'   => 'wpc_contact_section1_heading',     'type'       => 'text', ) );      }     add_action( 'customize_register', 'wpc_customize_register' );