functions.php dead end
-
I’ve tried and tried and tried over months and on several websites to follow directions I’ve read many places (including the WP Codex) to add a snippet of code to my functions.php file(s) that will adjust the length of excerpts:
function custom_excerpt_length($length) {
return 20;
}
add_filter(‘excerpt_length’, ‘custom_excerpt_length’);I’ve examined functions.php files from other sites of mine built on a variety of themes to try to understand how they, well, function. And I’ve looked through as much explanation regarding functions.php as I can find (including WP Codex docs).
Yet I never get the code to work and I generally “break” the website, sometimes having to upload a new functions.php file to the theme directory to make the site work.
I understand that functions.php is a php file and should, I think, begin and end with standard <?php , ?> tags or markup or whatever. But whether I put the excerpt code within these brackets or without, the file returns errors. I’ve even had the wp-admin lock me out trying to adjust the functions.php per directives from reliable WP pros.
so
A) I’d love to know what I’m doing wrong regarding the excerpt code and, more importantly
B) I’d love directions on where to find thorough documentation about functions.
I’ve been customizing WP themes for myself and clients for a few years now and I really feel like mastering functions is something I need to do. I just can’t, for the life of me, find documentation that gets me over the hump. And the WP Codex really isn’t helping me.
Thanks, so much, for guidance.
Brad
- The topic ‘functions.php dead end’ is closed to new replies.