php - WordPress child theme files in subdirectory not overriding -
i modifying wordpress theme using child theme. in child theme folder, have created folder called "includes" (just parent) , have made edits content-post.php, content-single.php , content-single-portfolio.php files. have added functions.php file in child folder:
require_once( get_stylesheet_directory() . 'includes/content-post.php' ); require_once( get_stylesheet_directory() . 'includes/content-single.php' ); require_once( get_stylesheet_directory() . 'includes/content-single-portfolio.php' );
this causes 500 internal error , i'm not sure why.
reference: http://codex.wordpress.org/child_themes
i tried solution , same 500 error: wordpress child theme including includes files
returns absolute server path (eg: /home/user/public_html/wp-content/themes/my_theme), not uri.
your code converted absolute url like
/home/user/public_html/wp-content/themes/my_themeincludes/content-single-portfolio.php
get_stylesheet_directory() should followed forward slash
require_once( get_stylesheet_directory() . '/includes/content-post.php' );
your best option check error log, 500 error message related php timeout, specially if site working fine before did php modification.
you can try doing 1 one each file
//checking if file exist if ( file_exists( get_stylesheet_directory() . '/includes/content-post.php') ) { //require file if exist, require_once( get_stylesheet_directory() . '/includes/content-post.php' ) } else { /* echo if file doesn't exist, if message wasn't displayed , still 500 error there's wrong on php file above*/ _e('file not found'); }
Comments
Post a Comment