I'd probably confess to be being more a web designer than a developer, but I'm fairly knowledgable with WordPress... ...after reading 'Digging into WordPress' (got the ebook) and similar books.
It appears to me though, that none of the DigWP theme make use of this recommendation. That wasn't really a question, I know, but I'm curious as to why..? Or, at least, some comment on this...
The TwentyTen and TwentyEleven themes make use of prefixes, but I find the functions.php files for each of these way to vast to actually follow along.
It's as if they've commented the heck out of it for hackers wanting to have a stab at customising the default themes.
Again, those weren't really questions, but it would be cool if there was a comprehensive, but simple reference / resource to a functions.php template...
Taking into account Justin's suggestions, his examples, and the notion of prefixing functions,-
Where should my custom post-type registrations go in the order of things?
And,do these need to be attached to a hook (considering these must fit into some sort of WordPress flow)?
As an aside, I've read Justin's article on CPT's, and I know how to register them myself, but an example would help...
I'm also using a couple of other functions:
function new_excerpt_more($more) { global $post; return '…'; } add_filter('excerpt_more', 'new_excerpt_more');
function string_limit_words($string, $word_limit) { $words = explode(' ', $string, ($word_limit + 1)); if(count($words) > $word_limit) { array_pop($words); //add a ... at last article when more than limit word count echo implode(' ', $words)."..."; } else { //otherwise echo implode(' ', $words); } }
Where should these go? Outside or the after_setup_theme or inside it?
According to the article, by using after_setup_theme, you should be using it to add custom filters to filter hooks. Aren't these both filters..? I'm not 'getting it' on these ones...
Lastly - and this is a tall order - would anyone, with sound knowledge and profound understanding, be willing to take a look at my functions.php file and give me some pointers?
As far as prefixes go, I'm not particularly sure they are relevant unless your are creating your own function that could interfere with WordPress' own internal naming (or perhaps a plugin that you install). For the most part I suppose this is unlikely, though perhaps it's something that I'll end up doing myself from now on.
I find all of the theme files for 2010 and 2011 to be quite confusing, myself. The themes that I create always seem to be much simpler and contain more functionality. I think it's simply because the 2010/11 themes are built for ultimate flexibility whereas custom themes that you might build are for a single site's purpose.
The order of functions shouldn't matter.
I'm sure we'd all be willing to have a look at your functions.php file. Since it might take up lots of room on the forum, maybe you could post it somewhere for people to see http://codepad.org/
That said, I've been reading Justin Tadlock's article on the functions.php file and how this file should be laid out properly, and I have a few questions:
Thanks in advance for any help and insights.
https://github.com/ggilmore/UltimateFunctions
As far as prefixes go, I'm not particularly sure they are relevant unless your are creating your own function that could interfere with WordPress' own internal naming (or perhaps a plugin that you install). For the most part I suppose this is unlikely, though perhaps it's something that I'll end up doing myself from now on.
I find all of the theme files for 2010 and 2011 to be quite confusing, myself. The themes that I create always seem to be much simpler and contain more functionality. I think it's simply because the 2010/11 themes are built for ultimate flexibility whereas custom themes that you might build are for a single site's purpose.
The order of functions shouldn't matter.
I'm sure we'd all be willing to have a look at your functions.php file. Since it might take up lots of room on the forum, maybe you could post it somewhere for people to see http://codepad.org/
Thanks for the reply, and for posting your functions template - very handy reference.
And, yeah, the post is a bit of a tall order. But a decent reference to this doesn't really exist, in my view.
I have uploaded 2 functions.php files for who ever is willing to help out to look at at:
Again, any help would be appreciate, so thanks in advance.