Title: Adding edited widget code to child theme
Last modified: August 22, 2016

---

# Adding edited widget code to child theme

 *  Resolved [globe.editor](https://wordpress.org/support/users/globeeditor/)
 * (@globeeditor)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/adding-edited-widget-code-to-child-theme/)
 * Hello,
 * I’m in the process of adding a child theme for our site. We use MH magazine lite
 * In the original mh-widgets file the code was changed for sections Home 1 (updated
   title position, changed slider navigation, shows excerpt, etc.) and Home 2 (spans
   2 columns, removed blank box for no thumbnails) among other things.
 * You can see the changes at [globeslcc.com](http://globeslcc.com)
 * I have pulled the edited code from the original mh-widgets into a separate file
   in the child theme, and using this reference page [http://codex.wordpress.org/Child_Themes#Referencing_.2F_Including_Files_in_Your_Child_Theme](http://codex.wordpress.org/Child_Themes#Referencing_.2F_Including_Files_in_Your_Child_Theme)
   I tried this code:
    `require_once( get_stylesheet_directory() . '/my_included_file.
   php' );` and I point it to the mh-widgets php file in my child theme but I get
   a “Fatal error: Cannot redeclare” error that crashes the site.
 * For the time being the edited code has been left in the main theme which is not
   ideal.
 * My main question is what or how can I reference the edited widget code in the
   child theme?
 * Thanks for your time.

Viewing 1 replies (of 1 total)

 *  [Michael](https://wordpress.org/support/users/mh-themes/)
 * (@mh-themes)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/adding-edited-widget-code-to-child-theme/#post-5694280)
 * Hi globe.editor,
 * thanks for using MH Magazine _lite_.
 * Your problem probably is caused because you have included the class of the modified
   widgets with the same class name as the original widgets which is causing a conflict.
 * You can either change the class name for your widgets and include them as new
   additional widgets or unhook/unregister the original widgets and then hook/register
   your version of the widgets.
 * But please notice that we can’t offer help with theme customizations for free
   as this is beyond regular theme support which is already free for this theme.

Viewing 1 replies (of 1 total)

The topic ‘Adding edited widget code to child theme’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/mh-magazine-lite/2.10.0/screenshot.
   png)
 * MH Magazine lite
 * [Support Threads](https://wordpress.org/support/theme/mh-magazine-lite/)
 * [Active Topics](https://wordpress.org/support/theme/mh-magazine-lite/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/mh-magazine-lite/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/mh-magazine-lite/reviews/)

## Tags

 * [child theme](https://wordpress.org/support/topic-tag/child-theme/)
 * [widget](https://wordpress.org/support/topic-tag/widget/)

 * 1 reply
 * 2 participants
 * Last reply from: [Michael](https://wordpress.org/support/users/mh-themes/)
 * Last activity: [11 years, 4 months ago](https://wordpress.org/support/topic/adding-edited-widget-code-to-child-theme/#post-5694280)
 * Status: resolved