Skip to Content

Frequently Asked Questions

Q: What happens if I copy a file that doesn’t exist in the parent theme?

A: WordPress will ignore the file unless it’s part of the WordPress Template Hierarchy. Always ensure you’re copying files that are part of the parent theme.

Q: Can I override files in subdirectories of the parent theme?

A: Yes, maintain the same directory structure in the child theme. For example:

  • Parent Theme File: templates/content.php
  • Child Theme File: templates/content.php

Q: Why aren’t my changes taking effect?

A: Ensure the child theme is activated and the file is correctly placed in the child theme directory. Clear your browser and site cache if necessary.

Hot Fix for Customizer getting wordpress error

Scenario: If there is parent and child theme inside your themes folder.

Solution:

  1. Go to your parent theme folder and open the functions.php file.
  2. Replace the below code:
functions.php
if ( ! defined( 'AIOS_THEME_CORE_URL' ) ) define( 'AIOS_THEME_CORE_URL', get_template_directory_uri() . '/core' ); if ( ! defined( 'AIOS_THEME_CORE_DIR' ) ) define( 'AIOS_THEME_CORE_DIR', get_template_directory() . DIRECTORY_SEPARATOR . 'core' );

with this code:

functions.php
if ( is_user_logged_in() ) { if ( ! defined( 'AIOS_THEME_CORE_URL' ) ) { define( 'AIOS_THEME_CORE_URL', get_template_directory_uri() . '/core' ); } if ( ! defined( 'AIOS_THEME_CORE_DIR' ) ) { define( 'AIOS_THEME_CORE_DIR', get_template_directory() . DIRECTORY_SEPARATOR . 'core' ); } }

Scenario 2: If there is only child theme inside themes folder.

Solution:

  1. Go to your terminal and run the below command:
composer require "aios-packages/theme_name":"version" Require and install specific version. or composer update "aios-packages/theme_name":"version" Require and install specific version.

What if i need to add another widget.

inc folder where widgets.php is not part of default wordpress Hierarchy, so if you want to add any custom functions, you can create a file in the inc folder of the child theme and include it in the functions.php file of the child theme. Please make sure that the class name is unique and does not conflict with the parent theme.

Sample Code:

widgets.php
<?php class AIOS_MOBILE_FIRST_THEME_WIDGETS { /** * Admin constructor. */ public function __construct() { add_action( 'widgets_init', [$this, 'ai_child_register_sidebars'] , 11, 2); } /* * Register sidebars */ function ai_child_register_sidebars() { $items = [ 'New Widget Bar', ]; foreach ($items as $item) { if (! empty($item)) { register_sidebar([ 'name' => $item, 'id' => sanitize_title($item), 'before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => '' ]); } } } } new AIOS_MOBILE_FIRST_THEME_WIDGETS();

functions.php file in child theme: with this code:

functions.php
<?php require('inc/enqueue.php'); require('inc/hooks.php'); require('inc/widgets.php'); /// Include the widgets file

CSS Selector Priority: Why Some Rules Don’t Apply and How to Fix It

When you have multiple CSS rules that target the same element (like .quicksearch), the browser decides which rule to apply based on a system called “specificity.” Here’s how it works:

Why is my CSS rule not working?

CSS rules with more specific selectors will override those with less specific selectors, even if the less specific rule comes later in the stylesheet. For example:

  • html body .quicksearch is more specific than just .quicksearch.
  • If both these rules set the background color, the more specific one wins, and the other is ignored.

You might also see this issue if different files or scripts insert styles with different selector specificity.

How to solve it

  1. Increase Selector Specificity: If your rule is being overridden, make your selector more specific. For example, use body .quicksearch instead of just .quicksearch.
  2. Adjust CSS Order: If selectors have the same specificity, the last one in the CSS will be applied. Move your rule after the conflicting rule if possible.
  3. Use !important (as a last resort): You can add !important to your rule to force it to apply, but this should be avoided unless necessary because it can make future maintenance more difficult.

Summary Table

SelectorSpecificityWill It Apply?Reason
html body .quicksearch0,0,2,1✅ YesMost specific, overrides others
body .quicksearch0,0,2,1❌ NoSame specificity, overridden by last rule
.quicksearch0,0,1,0❌ NoLess specific, overridden by above selectors
.quicksearch (with var)0,0,1,0❌ NoLess specific, overridden by above selectors

Summary:
Your CSS rule might not work because a more specific selector is overriding it. To fix this, either increase the specificity of your selector or ensure your rule comes later in the stylesheet. Only use !important if absolutely necessary.

Last updated on