Home Tutorials Child theme support

Child theme support

Available on: Newsmag V2.0+, Newspaper V6.3+

In the latest versions of our themes we decided to add better child theme support. The child theme support will gradually be more complete with each version we will release. As we promised you, the lost child-theme specific feature like overwriting single templates, modules, blocks, etc, has been brought back to you, without using the theme API.

With time we plan to add support for files located in the core framework of the theme (the /wp_booster/ folder).

The child theme support included in our themes is intended for developers to modify core parts of the theme without modifying the actual theme. This allows you to keep updating the theme without loosing your changes.

A sample child theme is available in the /code/ folder in the package that you downloaded form Themeforest.

What can be overwritten by the child theme:

The next sections describe what can be overwritten by the child theme. Starting with Newspaper 6.3 and Newsmag 2.1 we have extensive testing in place for each release aimed at maintaining compatibility with existing modifications.

1. Single Templates

In the theme the single templates are in the theme root path. Copy the single template file you need, to the child theme, into its root path, and modify it there as you wish. The theme will use it instead of the theme file, when you choose to use that single template for a post.

For example, single_template_1.php is copied to the child theme root path:

  1. The theme directory
  2. The child theme directory
  3. The single_template_1.php copied from the theme root directory path to the child theme directory path.

single_template_1.php copied into the child theme

 

2. Smart Lists

The smart lists files are in the …/theme_name/includes/smart_lists/ directory. Create the same directory structure under your child theme root path (…/child_theme_name/includes/smart_lists/), copy there the smart list file you need to modify and there you go.

Let’s see how we can overwrite smart list 1 from child theme.

  1. Go to the theme root path
  2. You have to localize the td_smart_list_1.php in the theme path
  3. Choose the td_smart_list_1.php from the smart_lists directory

As example, the smart_list_1.php is copied

child_theme_smart_list_1

Now, having the td_smart_list_1.php identified, you have to:

  1. Go to the child theme root
  2. Create a directory structure path in the child theme as in the theme
  3. Copy there the td_smart_list_1.php file and that’s it.

child_theme_smart_list_2

 

3. Modules

The modules files are in the …/theme_name/includes/modules/ directory. The modules are the elements for showing the post content, and they are used inside of the wordpress templates (achive, author, category, etc) and/or as block components. Each block is a container for some of these modules. You have to see what module you need to be overwritten by the child theme, and copy it the the child theme under a similar directory structure (…/child_theme_name/includes/modules/).

You have to consider that modifying a module that’s used by multiple block and templates, all of theme will use your modified module.

Let’s see how we can overwrite module 1 from child theme.

  1. Go to the theme root path
  2. You have to localize the td_module_1.php in the theme path
  3. Choose the td_module_1.php from the modules directory

child_theme_module_1

Once you have identified the td_module_1.php , you have to:

  1. Go to the child theme root
  2. Create a directory structure path in the child theme as in the theme
  3. Copy there the td_module_1.php file and that’s it.

child_theme_module_2

 

4. Headers

The headers are in the …/theme_name/parts/header/ directory. Create the same directory structure under your child theme root path (…/child_theme_name/parts/header/), copy there the header file you need to modify and it’s ready to be used.

Let’s see what happens when you want to overwrite the header style 1 from child theme:

  1. Go to the theme root path
  2. You have to localize the header-style-1.php in the theme path
  3. Choose the header-style-1.php from the header directory

child_theme_header_1

Now, all you have to do is:

  1. Go to the child theme root
  2. Create a directory structure path in the child theme as in the theme
  3. Copy there the header-style-1.php file and here you go.

child_theme_header_2

 

5. Blocks

Mainly, the blocks are used as modules’ containers. They are located in the …/theme_name/includes/shortcodes/ directory. There you can choose what block files you need to modify by the child theme, and copy them to the child theme, into the same directory structure (…/child_theme_name/includes/shortcodes/). Inside of one block file you’re able to see what modules are used (td_module_).

For example, for overwriting block 1 from the child theme:

  1. Go to the theme root path
  2. You have to localize the td_block_1.php in the theme path
  3. Choose the td_block_1.php from the shortcodes directory

child_theme_block_1

Having the td_block_1.php, you just have to copy it to the child theme, so:

  1. Go to the child theme root
  2. Create a directory structure path in the child theme as in the theme
  3. Copy there the td_block_1.php file and that’s all, it’s ready to modify.

child_theme_block_2

 

6. Block template

The block templates are in the …/theme_name/includes/block_templates/ directory. As of now, we have just one block template, but it’s set as the others components of the theme for the flexibility in adding new features. If you want to modify a block template, make the same directory structure path in the child theme (…/child_theme_name/includes/block_templates/) and copy the block template there. The blocks that are using the block template, knows to load your child theme block template now.

Let’s see what happens when you want to overwrite the only block template, from child theme:

  1. Go to the theme root path
  2. You have to localize the td_block_template_1.php in the theme path
  3. Choose the td_block_template_1.php from the block_templates directory

child_theme_block_template_1

Now, all you have to do is copying it to the child theme, so:

  1. Go to the child theme root
  2. Create a directory structure path in the child theme as in the theme
  3. Copy there the td_block_template_1.php file and there you are.

child_theme_block_template_2

7. Category template

The category templates are in the …/theme_name/includes/category_templates/ directory. Make the same child theme directory structure (…/child_theme_name/includes/category_templates/) and copy there the category template you want to modify.

For example, let’s modify the category template 1, from the child theme:

  1. Go to the theme root path
  2. You have to localize the td_category_template_1.php in the theme path
  3. Choose the td_category_template_1.php from the category_templates directory

child_theme_category_template_1

As we have told you, the td_category_template_1.php has to be copied to the child theme, so:

  1. Go to the child theme root
  2. Create a directory structure path in the child theme as in the theme
  3. Copy there the td_category_template_1.php file and there you are, the file is ready to be modified

child_theme_category_template_2

8. Category top post style

The category top post style templates are in the …/theme_name/category_top_posts_styles/ directory. As you should know, you have to make the same directory structure (…/theme_name/category_top_posts_styles/) in the child theme, and copy there the template you need to modify. The child template will be load for the category top post style you have chosen.

The following steps you can follow to modify ‘category top post style 1’, from the child theme:

  1. Go to the theme root path
  2. You have to localize the td_category_top_posts_style_1.php in the theme path
  3. Choose the td_category_top_posts_style_1.php from the category_top_posts_styles directory

child_theme_category_top_post_style_1

Now, all you have to do is just to copy it to the child theme, so:

  1. Go to the child theme root
  2. Create a directory structure path in the child theme as in the theme
  3. Copy there the td_category_top_posts_style_1.php file and that’s it.

child_theme_category_top_post_style_2

9. Footer template

The footer templates are in the …/theme_name/parts/footer/ directory. Make the same directory structure in the child theme (…/child_theme_name/parts/footer/) and copy there the footer template you need to modify.

For example, using the child theme for modifying the footer template 1, all you have to do is:

  1. Go to the theme root path
  2. You have to localize the td_footer_template_1.php in the theme path
  3. Choose the td_footer_template_1.php from the footer directory

child_theme_footer_1

 

Now copy the td_footer_template_1.php to the child theme, so:

  1. Go to the child theme root
  2. Create a directory structure path in the child theme as in the theme
  3. Copy there the td_footer_template_1.php file. That’s it!

child_theme_footer_2

 

10. Comments

Usually the wordpress templates should be easily modified by copying them into the child theme. Also the comments file can be modified using child theme, you just need to copy the comments.php file from booster theme directory path (…/theme_name/includes/wp_booster/comments.php), to the root child theme path.

child_theme_comments_2

Important! Do not copy the root theme comments.php to the child theme path.

child_theme_comments_3

Inside of it you should read the same info.

child_theme_comments_1

 

11. Other specific theme files that can be modified using child theme, are the following from td booster theme directory:

  1. td_css_inline.php
  2. td_login.php
  3. td_category_template.php
  4. td_category_top_posts_style.php
  5. td_page_generator.php
  6. td_block_layout.php
  7. td_template_layout.php
  8. td_css_compiler.php
  9. td_module_single_base.php
  10. td_smart_list.php

For these files you just have to create in child theme a directory structure path like the one existing in the theme (…/child_theme_name/includes/wp_booster/ directory), and copy there the files you need to modify.

 

12. The wordpress templates which are not loaded by theme API, like archives.php, header.php, etc, have child theme standard support.

 

The theme API in the child theme:

 

Important! We strongly DO NOT RECOMMEND using the theme API from the child theme.