Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
Copy the content.php file from your parent theme and paste it into your Child Theme folder. Then edit it within there.
[edited – Andrew’s too fast for me π – hi AN!]
You can then put a copy of that file in the child theme and make the changes there. The child theme will use that version of that file rather than the parent.
But that doesn’t apply to functions.php file – which cannot be copied to the child theme.
Thread Starter
zep101
(@zep101)
Hey WPyogi, can you help me with this I saw in the tutorial that I should make a functions.php file so I did and it is in the child directory but I am not sure about it so it is empty. Is there some code that I should put in there?
Sure, it should have this:
<?php
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
But if you do the above, make sure that your style.css file does not have any @import line.
Thread Starter
zep101
(@zep101)
My style.css has an import line here:
`/*
Theme Name: twentyfourteen-child
Theme URI: http://www.jozepfit4life.com/
Description: This is a child theme of 2014
Author: Joe Koppel
Author URI: http://www.jozepfit4life.com/
Template: twentyfourteen
Version 0.1
*/
@import url(“../twentyfourteen/style.css”);
Should I remove it?
Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
Thanks WPyogi, excellent support as usual!
Thread Starter
zep101
(@zep101)
One more thing …how do you “Copy the content.php file from your parent theme and paste it into your Child Theme folder.”
I don’t really see how to do this. I am using Filezilla, do I download the file I want and then upload to the new location? If I do that will it remove it from the one I am copying it from?
I don’t see a way to copy and paste???
Thread Starter
zep101
(@zep101)
Need some help…when ever I try to add anything to my functions.php in my child theme I get “INTERNAL SERVER ERROR”
Even when I remove what I put in there and save it I still get the error.
Here is what I have in there that was given to me by WPyogi
`<?php
add_action( ‘wp_enqueue_scripts’, ‘theme_enqueue_styles’ );
function theme_enqueue_styles() {
wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’ );
}
The only way I get it to work is to delete the child functions.php file and recreate it with the same code and then it works again??? very strange.
Any thoughts on this?
Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
What is the entire code of your Child Theme functions.php file when this issue occurs?
Thread Starter
zep101
(@zep101)
Hi Andrew and thanks here is what I was trying to do to make excerpts instead of full posts, I got this online here
Here is the code I was trying to use:
<?php
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
add_filter( 'the_content', 'wpsites_limit_content_conditionally' );
function wpsites_limit_content_conditionally( $content ) {
return substr($content, 0, 100) . '<a href="' . get_permalink() . '">Read More Link</a>';
}
return $content;
}
Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
Not sure if it makes a difference, but can you close PHP at the end of the file? (?>
), e.g.:
return $content;
}
?>
Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
Also looks like you have too many curly braces, run your code through a syntax checker http://phpcodechecker.com/