Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #311502

    Hello Support,

    I have created a couple of customizations in loop-index.php and postslider.php to show my custom fields. Following the advice of support I have created a child theme and took the latest version of the theme as parent… I’ve redone the modifications on the latest theme files and saved them in a same name directory in the child theme folder.

    Somehow the parent files are not overwritten by the child theme. What am I doing wrong? Please see this image where I show the differences.

    https://imageshack.com/i/ipXnuWSwp

    I’ve set back the site to my modified theme. If you would like to see it live in action, please let me know, I will enable the child theme.

    Thanks in advance!

    • This topic was modified 9 years, 11 months ago by originaltours. Reason: Image link added
    #311652

    Hey originaltours!

    Thank you for using Enfold.

    If you want to edit the shortcodes like postslider.php, add this code on the child theme’s functions.php:

    add_filter('avia_load_shortcodes', 'avia_include_shortcode_template', 15, 1);
    function avia_include_shortcode_template($paths)
    {
    $template_url = get_stylesheet_directory();
    array_unshift($paths, $template_url.'/shortcodes/');
    
    return $paths;
    }

    Create a folder called “shortcodes” then place the postslider.php there.

    Best regards,
    Ismael

    #311720

    Thanks, does this work the same for loop-index.php?
    And other files I’d like to customize?

    Thanks in advance for your superior support!

    #312330

    Hi!

    The loop-index file should be replaced automatically as long as its the same name and in the same folder in your child theme. Its being called by the get_template_part function which is already child theme friendly for *I think* every instance in the parent.

    Regards,
    Devin

    #312333

    Thanks for that, Devin…

    Although I’m a little confused right now. For the postslider.php file I have to create a function in functions.php and for loop-index.php not. So which files should be called via functions.php and which not?

    I’m requesting this as my nl_NL.mo file in the folder lang of the child theme is not overwriting the nl_NL.mo file of the parent… I’m wondering how I should get this to work.

    Thanks in advance!

    #312343

    WordPress has a number of functions that determine what will be used in a child theme instead of the parent. Anything that is called using the get_template_part function from a theme file for instance will look for the file being requested in the child theme first.

    For the ALB elements (postslider.php) you need to use a function to tell Enfold that the child theme has a folder to check before looking in the parent since WordPress alone doesn’t know about the themes custom stuff.

    For the translation file it looks like you need to add the file in your child theme root directory and then tell WordPress about it via a function: http://codex.wordpress.org/Function_Reference/load_child_theme_textdomain

    #312349

    Thanks, that explains it all! I’ll look into the translation file.

    Ticket can be closed.

    Thumbs up!

    #312356

    Glad we could help :)

    #731504

    Thanks, topic can be closed

    #731861

    Hi,

    Thanks :-)

    Please open a new thread if you should have any further questions or problems.

    Best regards,
    Rikard

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Theme customizations not shown with Child theme’ is closed to new replies.