1

I am using the llorix_one_lite theme, and I love it. It has an awesome front-page with different sections, which are included in a "sections" folder. For example: llorix_one_lite_contact_info_section.php.

I have added a simple text field to the theme customizer on a local site. It works perfectly.

I did this by first creating a child theme: Llorrix_one_lite_child. And then in a "sections" folder I have a file called: Llorix_one_lite_child_contact_info_section.php, which is identical to the parent file with the exception of the h2 tag i am editing through the customizer.

When I upload this to a live site, it does not work. The child file (llorix_one_lite_child_contact_info_section.php) is not overriding the parent counterpart (llorix_one_lite_contact_info_section.php).

I know the code in the functions.php is working, as it saves the setting in the customizer, but is not outputted (because the get_theme_mod is never called on said ).

Should I rename the child file to: llorix_one_lite_contact_info_section_child.php? --- Or: llorix_one_lite_contact_info_section.php?

I only tried the latter on my local machine, but it breaks the section. It shows up in the customizer, but changes nothing on the frontend.

Thank you for reading my long (and first post) here on the wordpress community. I am new at wordpress develeping, but hope to have a career in web development and/or front-end developing.

Thanks

Edit: As requested by WebElaine I included the files below.

First the child themes function.php

//add contact_info_heading in customizer
function wpl_customize_register( $wp_customize )
{
//sections, control, and settings go here
$wp_customize->add_setting( 'contact_heading_text' , array(
    'default' =>    'Giver Uforpligtende Tilbud',
    'transport' =>  'refresh',
    'type' => 'theme_mod',
    ) );
$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'contact_heading_text', array(
    'label'      => __( 'Contact Heading Text', 'wpl' ),
    'section'    => 'contact_heading_section',
    'settings'   => 'contact_heading_text',
    'type'      => 'text',
) ) );
$wp_customize->add_section( 'contact_heading_section' , array(
    'title'      => __( 'Kontakt overskrift', 'wpl' ),
    'priority'   => 60,
) );

}

add_action( 'customize_register', 'wpl_customize_register' );

Now the llorix_one_lite_child_contact_info_section.php (the h2 tag i am trying to alter. Tell me if you need the entire file. It is very long and mostly filled with HTML

    <h2 class="tilbud-text"><?php echo get_theme_mod( 'contact_heading_text' ); 

And an image of the file structure of the theme abd child theme. enter image description here

Both of these files are on my local machine, where everything works perfectly.

Now the corresponding files for the live server:

The functions.php is exactly the same (I just copy pasted it). as is the llorix_one_lite_child_contact_info_section.php.

To test what is happening, I wrote a comment in the parent on the live server: llorix_one_lite_contact_info_section.php that tells me if it is the parent file that is being used. I have a screenshot below where said comment is marked. The heading in the picture is the one I am trying to change: enter image description here

I hope this clears it up.

EDIT:

To add to things I do not understand - I looked through my front-page.php (which succesfully overrides the parent one) both locally and on the live server.

It has this array that id uses to include the sections on the front page:

$sections_array = apply_filters(
    'llorix_one_companion_sections_filter',
    array(
        'sections/llorix_one_lite_logos_section',
        'sections/llorix_one_lite_our_story_section',
        'sections/llorix_one_lite_content_section',
        'sections/llorix_one_lite_ribbon_section',
        'sections/llorix_one_lite_latest_news_section',
        'sections/llorix_one_lite_child_contact_info_section',
        'sections/llorix_one_lite_map_section',
    )
);

if ( ! empty( $sections_array ) ) {
    foreach ( $sections_array as $section ) {
        llorix_one_lite_get_template_part( $section );
    }
}

I tried changing the file name to match different ways. If my actual file name is: llorix_one_lite_child_contact_info_section, and the string reference is the same everthing works (locally). However, if I change the string reference (or delete the array entirely), everything still works... But if I change the actual file name to correct name (without the _child), and change the array to the same, it does not work. The file is not included on the frontpage.

  • 1
    Can you share the contents of the two files so we have a better idea what the code is doing? In theory you should have the exact same file name and folder structure in the child theme as the parent theme, but perhaps something else is going on here. – WebElaine Apr 17 '17 at 19:56
  • Thanks. You definitely need to name the file exactly the same as the parent theme - don't include the word 'child'. So it should be 'llorix_one_lite_contact_info_section.php'. I'm guessing there may be something in that file or the parent theme's version of that file which is conflicting. Those would probably be more helpful to post. :) – WebElaine Apr 18 '17 at 15:05
  • Then how come it works with the current file name on my local server? And if I do as you suggest, it stops working. I have not tried on the live server though – ibbadib Apr 18 '17 at 18:05
  • To clarify: The section just does not show up in the front-end, when I name the files exactly the same – ibbadib Apr 18 '17 at 18:12
  • "It works with the current file name on my local server" = you have no problem? Then by all means do it that way. If you are having trouble though it is partly because your child theme file name is supposed to match the parent theme. As mentioned you probably need to review both files' contents to find the conflict. – WebElaine Apr 18 '17 at 19:55
0

I completely remade the childtheme. I think I had some conflicting code somewhere. I want to thank @WebElaine a thousand times for your time and help.

I think the moral of the story is: Think.

  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review – cjbj Apr 19 '17 at 7:26
  • I asked the question. I wanted to make it clear I solved it. – ibbadib Apr 19 '17 at 7:27
  • Yes, but if somebody else finds this question and has a similar problem, this answer is not going to help him, because you don't explain how you solved it. – cjbj Apr 19 '17 at 10:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.