Hi I am making my own theme in WordPress and setting up some customizer options and I have one for the text in my footer but I would like to still use <? echo date('Y');?> in the footer to dynamically change the date so I don't have to keep going in and doing it manually but the sanitizer call-back obviously blocks it is there a way to still be able use that php function in the sanitizer here is my …
I use this code to name the Widget Panel. It functions good half the time. The other half of the time the Widget Panel loads too fast it seems and the other sections/panels do not show in customizer. So the only section in customizer is Widget Panel half the time and you need to force refresh page for the customizer to load correctly with all the options displaying. Is there a better code to use to avoid this problem? function …
So I've created a panel in the customizer section in WordPress to add the phone number to the site. It works fine in the back end but it wont show up in the front end here is my functions.php function home_smart_register_theme_customizer( $wp_customize ) { $wp_customize->add_panel( 'contact_info', array( 'priority' => 10, 'theme_supports' => '', 'title' => __( 'Contact Info', 'home_smart' ), 'description' => __( 'Set your current address.', 'home_smart' ), ) ); $wp_customize->add_section( 'contact_details_block' , array( 'title' => __('Phone Number','home_smart'), 'panel' …
Ok here's the scenario: I have added a custom section to an existing theme so that it shows up in the theme customization page (customize.php). The problem I am having is that I don't know how to notify wordpress when changes are made in my custom control. I guess I am missing something in my code because it should do it in automatic? Here is some sample code: $wp_customize->add_section('my_section', array( 'title' => 'My title', 'description' => 'My description', 'priority' => …
Here's the scenario - I want to select fontawesome icons from the dropdown list but it's not working. For some reason the class inside span is not adding up (I have tried jQuery().append(), CSS) but so far no luck. ANY help would be appreciated. Code in Page.php file <div class="features-block-one"> <div class="icon-one"> <span class="<?php get_theme_mod('features_one_icon' ,'fa fa-bullseye');?>"> </span> </div> </div> Code in Customizer file //block one icon $wp_customize->add_setting( 'features_one_icon', array( 'default' => 'fa-fa box', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_key', …
I'm working on wordpress project, Theme have some demos i've added add_menu_page where all of the demos stored e.g pictures and names, I know the REST-API where i've added condition if theme license is correct then give file, But i don't know how to add that file in theme directory of wordpress when user will click and remove previous one or overwrite previous file.
I'm using the Wordpress customizer feature to configure my theme and I constantly bumping into the same annoying issue, sometimes I don't get any value from get_theme_mod while I see the effect of my change in the preview window. Here is some code: $active_type="home"; $wp_customize->add_setting($active_type.'_categories_max',array( 'default' => '10', 'transport' => 'refresh' )); $wp_customize->add_control( $active_type.'_categories_max',array( 'type' => 'select', 'label' => 'Max Items', 'section' => $active_type.'_categories_section', 'choices' => array( '5' => '2', '10' => '10', '15' => '15', '20' => '20', ), …
I want to make a logo manager in the Customizer, but how do I set different image sizes with the WP_Customize_Cropped_Image_Control class? Example from Make WordPress Core: $wp_customize->add_control( new WP_Customize_Cropped_Image_Control( $wp_customize, 'cropped_image', array( 'section' => 'background_image', 'label' => __( 'Croppable Image' ), 'flex_width' => true, // Allow any width, making the specified value recommended. False by default. 'flex_height' => false, // Require the resulting image to be exactly as tall as the height attribute (default). 'width' => 1920, 'height' => …
I am trying to create an image control using: wp.customize.control.add( new wp.customize.Control( myControlSettingID { type: "image", button_labels: {select: 'Select image', change: 'Change image', remove: 'Remove', default: 'Default', placeholder: 'No image selected'...} description: "Upload or select an image for this featured link" id: "issue_section_term_apple_settings_link_image" label: "Custom image" priority: 1 section: "issue_section_term_apple_section" } ) ); I am using the "type" property and set it to "image" which is what the WP_Customize_Image_Control php class has set for the class "type" property. This is …
I want to exactly add settings to the static_front_page section in the customizer Sections homepage, I wrote code in functions.php for that but it doesn't work. my code in functions.php file: function mytheme_customize_register($wp_customize) { $wp_customize->add_setting( 'homepage_heading', array( 'capability' => 'edit_theme_options', 'default' => '' )); $wp_customize->add_control( new WP_Customize_Control($wp_customize, 'homepage_heading_control', array( 'label' => 'Homepage Heading', 'section' => 'static_front_page ', 'settings' => 'homepage_heading' ) )); } add_action('customize_register', 'mytheme_customize_register');
From my research there are only two questions I've found around this topic on this site: How to change in customizer the “site identity” tab required capabilities how to change default icon of custom plugin? outside of the site I did find: How to Add a Default Site Icon in Theme's Customizer but when I try: function default_icon() { global $wp_customize; $wp_customize->get_setting('site_icon',array ( 'default' => home_url() . 'img/test.png' )); } add_action('customize_register','default_icon'); I've also tried add_setting with: function default_icon() { global …
I have implemented theme options using WordPress customizer with a mix of native WordPress customizer fields and Kirki framework. This works great. Now, I wonder if it is possible to add a separator between my theme options and default WordPress customizer options. Something similar to the attached image. Guess, this can be achieved by overriding custom CSS. But a native and cleaner approach is what I am looking for.
I need to load a callback function after a wp.customize.previewer.refresh(). I need this because I want to update a template position which is displayed with a custom hook in my theme and scroll the preview frame on the new template position. I use wp.customize.previewer.bind('synced', ...) but every time I change the position on my control, this bind event calls itself as many times as I change the position. So after the first position update on my control, the bind event …
I am trying to change a CSS Variable value in customizer and couldn't get live preview working using 'postMessage'. It works if I use 'refresh' option. Can someone please have a look at the code and point me to the right direction. Thanks. customizer.php code /** * Registers settings and controls with the Customizer. * * @param WP_Customize_Manager $wp_customize Customizer object. */ function mytheme_customize_register( $wp_customize ) { $wp_customize->add_setting( 'primary_color', [ 'default' => '#b3000e', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage', ] …
Not sure if OOP is covered here but i've copied the class-twentytwenty-customize.php file from the Twenty Twenty parent theme to my child theme and renamed it to class-customize.php because i need to modify it and add more settings to the customizer, but i get errors. I changed line 16 from this class TwentyTwenty_Customize { to this : class TwentyTwenty_Customize_Extended extends TwentyTwenty_Customize { What am i missing I'm loading the class in my child theme like this require get_stylesheet_directory() . '/class-customize.php'; …
I'm trying to create multiple value customizer control like: typography - Color, font-family, Size, etc .... I could create a control and initialize each control class in the constructor, but how can properly group it to one container and label it for example: Typography. Something like this ( not talking about any CSS ): Thanks
I want my theme to be very customizable, and so far i have provided the possibility to change text and link colors to the body, plus the background color which comes by default (I'm using the underscores starter template: https://underscores.me/) and background and link colors for the navigation bar. The way i was able to implement this was by using the wp_add_inline_style that WordPress provides, which i learned with this excellent tutorial: https://www.cssigniter.com/how-to-create-a-custom-color-scheme-for-your-wordpress-theme-using-the-customizer/ This is my code so far (Warning, …
I've seen codes that use something like: $this->default; I don't know the logic for that style of code yet. To grab a default for spesific customizer control or from a configuration file instead of using a hard coded within another echo or similar. For example, I don't want to write like this: if (isset($yeah['cool_color'])) : echo 'background:' . $yeah['menu_gradient']; else : echo 'background:#000000'; endif; I want to write something like this: if (isset($yeah['cool_color'])) : echo 'background:' . $yeah['menu_gradient']; else : …
I want to have following vertical structure on my products short description: Image->Product Name->Short Description. I've read that by default it is this order. This is the code I'm using: function short_desc_product() { the_excerpt(); } add_action( 'woocommerce_after_shop_loop_item_title', 'short_desc_product', 40 ); I'm using free Astra Theme. And it keeps showing this structure: Image->Short Description->Product Name. For any other theme it is showing in a wanted way. Any advice on this? Thank you.
Welcome I am developing a theme and I need to add wysiwyg editor to the customize screen using the “customize_register()” , I searched a lot here and on other sites about how to add it, and although there are many answers, it did not work for me So please help me to find a solution to do this Thank you in advance