You need to make sure that your css goes between style tags. Try changing this line:
.btn { background-color:<?php echo esc_attr($btn_color);?>; } <?php
to
<style>.btn { background-color:<?php echo esc_attr($btn_color);?>;</style> } <?php
Related Posts:
- Display random categories on the front page (Finding and Editing Theme Functions)
- is_customize_preview() like function to check if Customizer “Live Preview” in JavaScript
- Some questions about how proper add 2 CSS file in a WordPress theme?
- Getting the teaser text without overriding global variables
- “options.php” not found
- Why a SlideShow (made using JQuery FlexSlider) can’t work if I load it form functions.php but work if I load it from my footer.php file? [closed]
- Why I can’t load my JavaScripts using an hook inside my functions.php file?
- How to get postId from the argument $block when register_block_type()?
- How to use webpack in WordPress theme? I want some scripts to load in the footer, some in the header and some with script parameters
- Check if the image size is available and if not use ‘full’ image size
- Way to store featured image width and height in two separate variables?
- Remove Custuomize Sections
- Can we create our own theme’s function.php?
- Not all CSS elements transferring via parent to child?
- unnecessary request call for js and css after calling wp_dequeue_script
- Define PHP variable from a seperate API if statement
- Excerpt for pages not showing
- get_pages() Returns Only One Item
- get_template_directory adding FTP root folders in urls
- Turn get_posts as string into an array for use in theme admin options
- Filter nav menu items HTML tags and wrap inner text with span
- Does size of a theme’s functions.php file matter?
- Functions php shortcode for displaying main menu with no child items
- get_next_posts_link() returns no result despite available posts
- Nav menus all outputting the same links
- PHP 7.1 | Warning: A non-numeric value encountered in
- Can’t switch to a child theme using filters template, option_template and option_stylesheet
- Redirect website domain (including all pages) to external URL after Popup message (few seconds)
- How to insert class in each list of categories?
- I can’t add CSS with functions.php
- Default Nav Highlight
- Combine two active_callbacks into one on theme customizer
- WP Customizer API loaded into functions.php
- call_user_func_array() expects parameter 1 to be a valid callback, function
- why can’t i add front.css to my frontpage.php
- How to store a number (coming from cookie) into query vars for later usage in other filters?
- Is this an acceptable practice for WordPress theme development?
- What is the correct way to include my new functions and scripts in WordPress?
- How to override this theme function in child theme
- wp_nav_menu work in functions.php but not in the theme
- get_template_directory() – references parent theme directory
- Rewrite Question Mark in Post Template with URL Parameter for clean URLs
- contact form in template with jquery,validate and ajax
- How do I preserve changes to a theme’s functions.php across updates?
- How can I assign separate stylesheets to different pages?
- How to make sure relative URL works when site is not on root domain?
- Can’t change theme name
- What function actually renders the wp_admin_bar ? How can I call it?
- Removing the custom_image_header from wp_head
- Woocommerce Variable Product Dropdown for Custom Shop Template
- Dynamically switch file in get_template_directory_uri() | Function [closed]
- Astra theme – cannot set short product description under the product title (product name)
- Uncaught TypeError: extract(): Argument #1 ($array) must be of type array, null given
- How to fix Function create_function() is deprecated in / themes
- Exclude specific post from query
- Advanced method to control cache of enqueued style/script
- WordPress wp_dequeue_script remove all other scripts
- Header menu aligned right on all pages except for single-post page [closed]
- Override category archive page title (not the head title)
- Can I use ‘Featured Image’ as a hero image and a thumbnail?
- Class parameter in get_avatar args doesn’t get added to output
- Is_Page doesnt detect my page
- Test CDN link from function.php or wp_enqueue_script/style?
- CSS style and app.js not loading
- How to customize archive widget only for cpt?
- wp_title() return random number
- Why does echo on functions.php not yield result in source code?
- How to offset main query without affecting other queries and backend
- Setting Up Child Theme To Take Priority
- Menu to the right of screen on desktop using Bootstrap 4
- Add meta data in head from theme
- what is `get_section()` and how to use it?
- Shortcode Initialization in a Custom Theme
- Remove External Links from WordPress posts Using add_filter() in Theme functions.php
- How to retrieve image IDs from shortcode content?
- HowTo: Add wrapper to columns shortcode?
- How can I add a custom checkbox / radio button on the admin theme options to display a CSS or other?
- How to create admin ajax function for my contact form
- Class::$template_dir_path=get_template_directory();
- How to disable site title and description when custom header is uploaded on the customizer?
- Getting back a blank WordPress site following functions code edit
- us states dropdown function and echo in theme template files
- How to pass a variable from a template page to the child theme functions.php
- wordpress not calling peliegro functions.php?
- Language switcher for subdomains
- How to add next height number in Order Attributes inside the Add new page. [duplicate]
- Load a Child Theme’s style.css just before the closing tag
- wp_nav_walker that interacts with widgets to setup mega menu
- Query custom post type and showing its content
- Random text changing to weird icons in both admin & front end
- Register a widget area when a theme option has been saved?
- Allow tags and attributes in post and pages content
- How does child theme functions.php work with parent theme functions.php? Is it like CSS? [duplicate]
- Additional Sidebar
- Add the title of a widget as an ID – for anchor links
- Why functions metaboxes is causing White Screen in Admin [closed]
- Which template file to edit to edit homepage in Mystile [closed]
- Getting error on function.php
- Adding function to function.php error 505 [closed]
- Why don’t ‘wp_nav_menu’ CSS classes work until a menu is created?