Please see this Codex article for further guide, but in your case, you would use esc_attr()
to escape the $second_col_class
value which is being used in an HTML attribute, namely class
:
<!-- bad -->
<div class="<?php echo $second_col_class; ?>">
<!-- good -->
<div class="<?php echo esc_attr( $second_col_class ); ?>">
<!-- good -->
<div class="<?php esc_attr_e( $second_col_class, 'text-domain' ); ?>">
Related Posts:
- Remove frameborder attribute from iframes
- correct tags for validating input types
- How to escape multiple attribute at once in WordPress?
- Data Validation & Sanitization for Big HTML Blocks
- How to use esc_attr__() function properly to translate a variable that contains string?
- Is there a way to prevent wp_head from outputting self-closing tags?
- Menu items description? Custom Walker for wp_nav_menu()
- What is $post_id? is it a global variable in WordPress?
- “Quick Edit” > update clears out my custom meta values
- Call dynamic_sidebar but include/exclude named widgets?
- Adding customizer styles with wp_add_inline_style
- Best practices – Should I create a child theme vs. customizing a framework theme? (such as HTML5 reset)
- Adding widgets programatically: how to avoid collisions?
- Why max-width:97.5% on content images?
- How do I get a parent theme modification from a child theme?
- Removing the default sidebar from admin panel
- Is there any need to use both wp_reset_postdata and wp_reset_query together?
- how to pull wordpress post comments to a external page
- Why use while over if in single wordpress posts?
- wp_enqueue_script being ignored in custom theme
- First completely customized theme, where should I start?
- How to change the customizer´s sidebar width?
- Single Theme folder for Multiple WordPress
- How i can get widgets areas working in customizer?
- Cutomize Colors utility: How to add more configurable colors to a theme
- WordPress post arrangement using post_class
- Removing non native customizer settings from a child theme
- How to prepare the HTML for WordPress [closed]
- Using wp_tag_cloud(‘format=array’) to print tag names without links?
- Link to a .po file in a child theme
- Alias to theme folder for local development
- Create wordpress header with custom logo in between the menu splitting the menu into two equal parts [closed]
- Access theme options in templates
- How to show post from category select
- Can’t work out why widget contents disappear from admin
- How to create a multiple choice radio group for a single theme option
- Edit footer via customizer
- gutenberg add classes to list items
- wordpress post category shows double`
- Move default page templates to sub directory
- $this->get_field_id() not working in customizer
- Migrated WordPress site renders Chinese
- How to modify default controls in WordPress theme customizer
- Why am I getting a white screen without a slash at the end of the address?
- Wireframe tool for WordPress theme [closed]
- Load sidebar template just once to prevent multiple animations
- Child Theme header1.php file not overwriting parent theme’s header1.php file
- How to use custom function in posts and pages templates
- What are the critical theme files when building a custom theme?
- Linking beetween pages in wordpress
- Having issue with WordPress wp_enqueue_style
- search.php file not pointing where it should
- How do I get standard posts to open up in their own template when using get_template_part()?
- Why does admin-ajax load slow and what are ways to speed it up?
- searchform.php doesn’t work properly
- Adding Bootstrap to WordPress TwentySixteen Theme
- What are the allowable Tags values in a theme file header?
- Following/tracing page construction through theme PHP
- my single.php is mixup on some post for no reason
- altering search terms
- Creating a theme update notification api [duplicate]
- Custom menu: Link names
- Post thumbnails Retrieve Url
- Stylesheet is not loading on firefox and IE!
- static front page ONLY for certain themes?
- How to add cropped custom header image?
- How to custom category template based on category?
- add_action for admin_init hook with a parameter
- custom post type query causing errors
- Category-specific loop not working
- Is it possible for the enqueue styles function to mess up my CSS?
- How to diagnose wp-env environment problem
- how can i remove js file from my footer in wordpress
- WordPress Admin bar missing from custom theme
- How to dynamically set a background image with the customizer without putting the css as an inline-style
- SIte logo is not displaying
- wordpress custom category post shortcode
- the_content() is getting null in Preview Debug
- Unable to delete option
- Different WP Rest API custom endpoints across different themes
- How to set different localization file for different users?
- overlay post title over post’s featured image
- how to add jquery to wordpress
- Hook in parent theme Menu function
- How to add custom nav_menu_css_class to certain menu only?
- Need help with adding custom menu content
- Import from HubSpot COS into WordPress 4?
- child comments not displaying as nested
- Simple loop with shortcode rendering problem
- Theme automatically inserting “more” tag on every post
- How get the 10 most viewed pages (not post)
- WordPress widgets manager option for emulating theme layout
- Conditional tags issue for multiple is_page() conditions in sidebar.php
- have_posts() return false on single post
- Im using a right approach to use this class inside WordPress theme?
- Is using display: none the proper way to hide elements in a theme?
- How to change order of elements using a child theme
- Twenty sixteen – full height
- Correct way to make a custom block theme responsive
- How to Enable Hot Module Replacement with Webpack