how to modify a php function in child theme without conflict?
-
twenty eleven theme.
I can use CSS in child theme no problem. But for php functions, sometimes it does not work if I modify php functions in child theme.
I know the difference: CSS in child theme will rewrite CSS in parent theme, so there is no conflict. But php in child theme won’t replace the parent function. sometimes it gives me headache.
e.g., I want to modify a php fuction in content.php:
<?php the_content( __( ‘Continue reading <span class=”meta-nav”>→</span>’, ‘twentyeleven’ ) ); ?>I new a file content.php under child theme directory. and
put a line of redefinition, like:
<?php the_content( __( my new fuction…) ); ?>It always prompts error when I load the page. Syntax is no problem coz it runs well if I just modify it in parent file.
Another example, if I want to add some script in header.php, like:
<script type=”text/javascript” src=”whateveritis.js”></script>I do the same thing in header.php in child theme, but it gets me error.
the script runs no problem if I just add it to header.php in parent theme.How to solve this? thanks.
- The topic ‘how to modify a php function in child theme without conflict?’ is closed to new replies.