-
AuthorPosts
-
March 27, 2018 at 6:29 pm #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?March 27, 2018 at 10:22 pm #933908Hey 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,
VinayMarch 28, 2018 at 11:25 am #934132Thank 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?
March 28, 2018 at 12:15 pm #934196Hi forever_prodotti,
What is the error?
Best regards,
VictoriaMarch 28, 2018 at 1:04 pm #934250All 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
March 28, 2018 at 9:52 pm #934547please help me
March 29, 2018 at 12:33 pm #934758Hi,
You have to copy the whole template files, unfortunately. Did you create a folder called “includes” in the child theme?
Best regards,
IsmaelMarch 29, 2018 at 5:03 pm #934910yes, 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.
March 30, 2018 at 8:02 am #935145Hi 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 -
AuthorPosts
- You must be logged in to reply to this topic.