Include Framwork files in Child Theme

  • Ankit
    Ankit
    Newbie 34 points
    August 16, 2015 at 5:50 pm

    Dear all,
    Here I’m going to ask about child theme & core files.

    Actually I want to modify few framwork files (defaults_coupon, class_shortcodes) but as It’s always good not to make changes in core files.

    So my question is “how can I include framework files in child theme..

    Currently my child theme have 3 files (index.php, function.php & style.css)

    Thanks.
    Ankit


  • Josh
    Super Guru 13,875 points
    August 16, 2015 at 6:25 pm

    Hello Ankit,
    Its not possible to add core files to child theme

  • Ankit
    Ankit
    Newbie 34 points
    August 16, 2015 at 8:00 pm

    So Is it safe to make changes in framwork files? I mean I will not replace in next update?

  • Mark
    Mark
    Titan 733 points
    August 16, 2015 at 9:04 pm

    No, you don’t make changes to the core files.

    What you need to do is to use function hooks and filters to change the functionality of the core functions. That is done in your child theme functions.php file.
    For example if you want to change behaviour of some shortcode, you can create your own shortcode that you can use to replace the ones from the theme (using remove_shortcode and add_shortcode).

    Mark

  • Ankit
    Ankit
    Newbie 34 points
    August 16, 2015 at 9:12 pm

    Thanks Mark.

    What about other core files like (search.php, content-listing-coupon.php & css files) ?

    Can I included them in child theme ? if yes then what is the way to do this?

    – Ankit

  • Mark
    Mark
    Titan 733 points
    August 17, 2015 at 12:32 am

    Any files that are found in the ‘root’ of the main theme can be copied and modified in the child theme. Any files found in the theme subfolders (e.g. under /framework/ ) cannot be included in child themes and their functionality can only be modified by using function hooks and filters.

    Any CSS can simply be modified by overriding any styles inside the child theme styles.css (that means if you want to change color of #wlt_search_tabs .btn {color:#444; } located in css.core.css you don’t need to edit that file directly, but simply write the definition in your child theme styles.css with the value you want. (e.g. #wlt_search_tabs .btn {color:#777; } )
    Sometimes you might need to use !important for the custom css to take effect. (e.g. #wlt_search_tabs .btn {color:#777 !important; } )

    This reply was awarded the best answer by the topic poster.
  • Mark Fail
    Mark Fail
    Super Guru 13,013 points
    August 17, 2015 at 3:06 am

    As above.

  • Ankit
    Ankit
    Newbie 34 points
    August 17, 2015 at 6:54 am

    Mark, you just made my day (thanks buddy)

    One more question – can I override bootstrap.css styles inside the child theme styles.css?

  • Ankit
    Ankit
    Newbie 34 points
    August 17, 2015 at 7:07 am

    Another question – In order to include core files (available on root) we need to just copy them in child them or need to do something else?

    -Ankit


  • Josh
    Super Guru 13,875 points
    August 17, 2015 at 8:19 am

    Yes you can override bootstrap.css styles in the Child Theme style.css.
    Here is guide on how to set up a child Theme in Premiumpress >>https://www.premiumpress.com/docs/#WHAT

  • Mark
    Mark
    Titan 733 points
    August 17, 2015 at 8:23 am

    One more question – can I override bootstrap.css styles inside the child theme styles.css?

    Yes (as Josh said above). You can override any css styling (even one included via plugins etc.).

    Another question – In order to include core files (available on root) we need to just copy them in child them or need to do something else?

    Just copy in your child theme and modify in there.

    You can read more on WP child themes here:
    https://codex.wordpress.org/Child_Themes

  • Clive
    Clive
    Super Guru 1,818 points
    August 17, 2015 at 10:56 am

    Another one resolved 🙂

  • Ankit
    Ankit
    Newbie 34 points
    August 17, 2015 at 12:14 pm

    🙂

Viewing 13 posts - 1 through 13 (of 13 total)

New Business Themes for WordPress 2020

Start your new website today!

View Business Themes