Questions tagged [get-theme-mod]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
2answers
13 views

Issue with theme mod options during domain migration

I want to migrate my development wordpress site to the production domain. In order to success the migration I found and replace all previous url occurences (http://localhost) to the new (https://...
0
votes
2answers
16 views

get_theme_mod only returns false

I have created a custom section with a setting with one control allowing users to choose fonts from a dropdown. However, when I use the get_theme_mod() function, and echo the results to a styles tag ...
0
votes
1answer
22 views

Don't print customizer styles when no setting has been used

I'm adding some options to a theme through my plugin, I want to change this theme styles and I'm almost there... Now I need to know how I can hide the <style> tag when no settings are changed (...
0
votes
1answer
63 views

Why is remove_setting and remove_control not working?

I've renamed my theme folder and all other title related bits, but I had a long list of settings and controls that were added with labels related to the old name, I want to remove these. I believe I'...
0
votes
1answer
76 views

How to add “get_theme_mod” inside a shortcode?

I want to make dynamic the content inside a shortcode so I can modify it in the customizer. I created the customizer tabs. Now, I want to create a shortcode to place it anywhere in the page while ...
0
votes
0answers
33 views

Fetch customizer image and output as an inline css style background image

So I have a feeling this is quite simple, but Im a bone head since I'm still learning PHP as I hack away at themes via my own child-theming... In short, I've built a customizer section in my ...
1
vote
1answer
367 views

get_theme_mod is returning a number rather than my image file

This is my first time attempting at implementing a custom panel into the customizer so bare with me please... In short, I am child-theming my site and want to make a basic modification to the parent ...
1
vote
1answer
36 views

Return a numerical function value in Customizer controls

I'm trying to add some controls to the WordPress Customizer feature, but I'm having trouble pulling the numerical value from the control to use in the theme. The section appears in the Customizer tab,...
4
votes
1answer
150 views

get_theme_mod doesn't return the theme customizer preview's new values in after_setup_theme hook

If I print the value of get_theme_mod( 'enable_sleek_header', false ) it is always the previously saved value. If I print the same thing in the header of the theme, it returns the value from ...
1
vote
1answer
318 views

How to make get_theme_mod work with AJAX in the customizer preview

Is it possible to make the get_theme_mod work after refresh in the customizer preview pane when it's being called inside a template part by AJAX? I have a theme that loads the posts on scroll (...
0
votes
1answer
64 views

How to properly delete and rename the custom settings/section/control in theme customizer?

I've created a custom customizer section for my client to set their contact phone number by using this snippet: function header_ctas ( $wp_customize ) { $wp_customize->add_section( 'cta_section'...
0
votes
1answer
802 views

get_theme_mod() only working when the customizer is open

I'm using the Customizer API to enable/disable different sections of a website. When I have the customizer window open it seems that get_theme_mod() is returning a value ok. However as soon as I save ...
0
votes
0answers
425 views

Correct was to customise theme using get_theme_mod in scripts

Am currently using get_theme_mod to offer theme customisations in CSS which works great. Would now like to offer theme customisations where it would alter JavaScript. Am currently achieving this ...
0
votes
2answers
150 views

Theme logo metadata into template file

I'm looking to pull all of the metadata (e.g. alt, width, height) from the theme logo, which is uploaded through Appearance -> Customization into my theme template file. This is what I currently have, ...
1
vote
1answer
758 views

Customizer live preview not working, refreshes but nothing change

Here is my code: // Hooked to "after_setup_theme" if(get_theme_mod('enable_vertical_header')) { // init vertical header, register scripts, style, settings and output html in template $...
2
votes
1answer
1k views

Get_theme_mod not retrieving value

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 ...
0
votes
1answer
599 views

get_theme_mod filter ignores sanitize_callback

So I've created some options for the theme customizer with sanitize callbacks. I want to be able to change those options with $_GET requests, but letting only valid values to pass, as they are ...
0
votes
1answer
518 views

Using get_theme_mod with checkbox to display content

I have a checkbox in the customizer which lets you choose to display content or not. I've got everything to work besides displaying the page content; it echoes the HTML tags but not the WordPress ...
0
votes
1answer
851 views

get_theme_mod outputs number when using WP_Customize_Cropped_Image_Control

I have added a few sections to the customizer but am having trouble when trying to call the image I have defined. The back end works great but when I call it using get_theme_mod it echos a two digit ...
0
votes
1answer
77 views

Using get_theme_mod in php ajax form doesn't work

I have a form on one of my wordpress site pages which sends mail with a php file which also validate the form details. I was unable to figure out why it doesn't work, until i found that if i remove ...
-1
votes
2answers
645 views

Echo Category In Loop

<?php $args = array( 'post_type' => 'product', 'stock' => 1, 'posts_per_page' => 4, 'product_cat' => '<?php echo get_theme_mod('vatname', 'Clothing'); ?>', '...
2
votes
3answers
1k views

get_theme_mod not working

For some reason I cannot output the color. Everything works, but text_color just doesn't want to output its value. What is going wrong? Back end code (functions.php): $wp_customize->add_setting('...
2
votes
1answer
2k views

Why does get_theme_mod return blank (or default value) but get_option returns saved value?

Why does get_theme_mod return blank (or the default value if specified) but get_option returns the correct (saved) value? I have a colour picker in the customizer color-primary which functions ...
0
votes
2answers
215 views

get_theme_mod returning cached values regardless of apache restart

get_theme_mod is returning cached content: this code: $parallax_one_logos = get_theme_mod('parallax_one_logos_content', json_encode( array( array("image_url" => ...
5
votes
1answer
109 views

Can I create customizer setting that can handle plugin shortcode?

Can I create a customizer setting which will handle a shortcode from a plugin? Do I violate and rules or guidelines in WordPress theme development? If it's possible what is the best way to sanitize ...
0
votes
1answer
92 views

Access preview settings in php

I'm working with the customize section of my theme framework. And I'm trying to get the preview settings in PHP when using refresh, but I only know how to access the saved settings. Short Story I ...
2
votes
1answer
3k views

get_theme_mod always returns default

I'm working on a website of a client and I'm trying to add social media links to the customizer, which then can be called through get_theme_mod, via a shortcode. However, when trying to call them, I ...
3
votes
1answer
3k views

customize_register with Multiple controls/settings - how to get values?

PHP newbie here, and I have this on my functions.php function mcs_social($wp_customize){ $wp_customize->add_section('mcs_social_handle', array( 'title' => __('Social Network ...
0
votes
1answer
351 views

get_theme_mod not pulling css colors into header using wp_head

I've had an issue with the theme customizer. On this page http://codex.wordpress.org/Theme_Customization_API you can go to: Part 2: Generating Live CSS And you'll see a way to fetch the settings ...
1
vote
2answers
2k views

if has theme mod

Does someone know how to write the next line in wordpress PHP, because i'm not that great with PHP. If_theme_mode has content echo { my content } else { other content }; thnx
0
votes
1answer
775 views

Use $wp_customize->add_control to create a selectable “Designed/Powered By” choices select w/ link in footer?

I'm trying to figure out if it's possible to use the Customizer controls to create a "Designed By [name]" dropdown menu, and have it echo out the name of the person/group with their name as a link to ...
15
votes
5answers
16k views

get_option() vs get_theme_mod(): Why is one slower?

I've been using get_theme_mod() for some time in various projects of mine. I decided to take advantage of the Theme Customization API in WordPress v3.4 once it was available as I felt it was an ...
4
votes
2answers
5k views

Use default value of wp_customizer in theme_mod output?

Is there a way to output the default value of a wp_customize text field type using the echo get_theme_mod (); without actually going in the Theme Customizer, modifying something and then saving it? ...
1
vote
1answer
2k views

Loop get_theme_mod

I've got a bunch of customizer settings set up Rather than calling individual get_theme_mod statements for each setting individually, is there a way to simplify it to loop thru them without having to ...
1
vote
2answers
5k views

adding checkbox to theme customizer

I have been trying to add a checkbox into the theme customizer. I have a checkbox added using this code in my functions.php function theme_customizer_register_checkbox($wp_customize) { $wp_customize-...
3
votes
1answer
831 views

Theme customizer: How do you grab the value later?

I'm working on a custom site, doing all my work in a child theme. I need to add one variable, slider speed, to the customize control system. I've been able to modify the custom controls via the ...
0
votes
2answers
343 views

How to make CSS load live based on options clicked in the theme customizer?

I have a problem. I am trying get the theme customizer load a different CSS file based on what radio input in clicked, live! It works so far right now that option is saved when I click "Save & ...
0
votes
2answers
3k views

Theme Customizer not displaying saved values in wp_head (CSS)

I've been learning hot to add theme customizer feature to a theme. Used few sources for the code and help, but chose the Codex in the end. I am using a snippet from the codex itself, slightly ...
2
votes
1answer
2k views

Crop image from get_theme_mod Customizer field

I'm using the following code to allow a user to upload a custom image (in addition to header image) through the customizer. Is there a way to crop the image when displaying it? $wp_customize->...
4
votes
2answers
4k views

How to hide get_theme_mod if field empty

I'm using: get_theme_mod to show various pieces of info from the theme customizer, in the following format: <a href=" <?php get_theme_mod( $name, $default ) ?> ">This is the link</a>...
1
vote
2answers
1k views

Update Theme Location Programatically

I've been trying to update my theme location programmtically and while the menu gets created with menu items, the theme location never gets set. Here is what I have: function create_my_menu() { if(!...
0
votes
2answers
476 views

How to internationalize header image?

I have in the following code in the template: <img src="<?php header_image(); ?>" /> However, I want to change this image according to the language selected (through GET parameter lang). ...