Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #933806

    Hi, I installed a child theme. The theme only includes a php file (function.php), but I would like to insert other php files, I’ve modified them and I do not want to change them when I make updates. For example, I would like to insert into the child theme the loop-index.php (“includes” folder). In this file I edit a line adding the “read more” with this code: $ blog_content =! Empty ($ avia_config [‘blog_content’])? $ avia_config [‘blog_content’]: “excerpt_read_more”;
    if (is_single ()) $ blog_content = “content”;
    If you are an update of the parent theme, this change is obviously reset. So I would like to insert this file, (or simply the line that interests me remains modified), in the child theme, so that when I make updates I do not lose the job done. How can I do?

    #933908

    Hey forever_prodotti,

    Please copy the complete loop-index.php file to the child theme and add your custom code to make changes.

    If you want to add just a single line you need to write custom functions and add the function to the functions.php file.

    Best regards,
    Vinay

    #934132

    Thank you. I had already copied all the code in the loop-index.php file, changing only the line that interested me and put it in the child theme. If I do this, however, there are 2 problems:
    1) The loop-index file is not the only one I have to modify. There is also the file helper-social-media.php and others;
    2) If I copy all these files in full and an update of the parent theme arrives, the copy of these files will be obsolete.

    For this I would like to insert in the child theme only the line that I am interested in modifying, not all the code. But I tried, for example, to insert only this code in the child theme, in the loop-index file:
    <?php
    $ blog_content =! Empty ($ avia_config [‘blog_content’])? $ avia_config [‘blog_content’]: “excerpt_read_more”;
    if (is_single ()) $ blog_content = “content”;

    but an error is generated. How can I do?

    #934196

    Hi forever_prodotti,

    What is the error?

    Best regards,
    Victoria

    #934250

    All pages are empty, without text and images. I would like to know how and where to write only the change that interests me, without copying entire php files

    #934547

    please help me

    #934758

    Hi,

    You have to copy the whole template files, unfortunately. Did you create a folder called “includes” in the child theme?

    Best regards,
    Ismael

    #934910

    yes, i do. The probles is: If I copy all these files in full and an update of the parent theme arrives, the copy of these files will be obsolete.

    #935145

    Hi forever_prodotti,

    Well, yes, you need to keep track of what modifications you made and on the next update, you need to update the files with the fresh ones and then add your modifications again.

    Best regards,
    Victoria

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.