[wp-hackers] Backup Plug-in and WordPress Plug-In System - Was Re:" "

David Clark david at davidsaccess.com
Mon Feb 14 15:20:20 GMT 2005


Hi Skippy,

I am going to redeem myself and be constructive this time.. :)
>
> the_category() is a core WP function, that sorts categories strictly 
> by their ID.  If I re-arrange the order of my categories, their IDs 
> won't change, so the final output won't be in the order that I had 
> wanted them in.
> snip
> Another example is one that comes up now and again: suppressing all 
> posts from a certain category from being included in The Loop on the 
> main page.  Simply filtering _after_ the default SQL query executes 
> can result in wonkiness: say you have posts_paged set to 5, indicating 
> that you want five posts to display.  WP will pull 5 posts from the 
> database.  If four of those posts are in the category you want to 
> suppress, your page will only show one post!
> The best way to do this is to modify the SQL query that collects the 
> posts to display.  But again, there's no elegant, hands-off way to 
> achieve this.  Even if you write a plugin to do the actual query, you 
> need to execute that plugin's function(s) somehow, which requires that 
> you edit some file(s).


I want to clarify,, are you talking about 1.2 or 1.5? I  would 
completely agree with you in 1.2 , and I'll use the example of the 
archiving system that I have at 
http://www.richardsnotes.org/archive.php in 1.2. I had to recreate 
several of the native functions simply because I could not pass it the 
variables I need to. At the time, I too felt leary about having to 
change index.php -- what I viewed as a "core" file.

Things are very different in 1.5, and I attribute it to 3 things.
1. Themes -- you no longer edit the sole index file. You copy the 
default theme dir, give it  your own name, and go to town. This will 
never be overwritten by an upgrade, given that the wp-content dir does 
not contain core files that need to be upgraded.
2. Filters -- your desire to su/press categories is a snap  in 1.5 
given the robustness of the API (application programming interface). 
Every action has a name that plugins can  "piggy back" onto, adding 
code with out touching the core.
3. My own learning -- I had to go through the process of hacking core 
functions (as shown above) to understand a different way. 
http://www.ldresources.org/ went live last week with all of the same 
archiving functionality (and more), but done in 1.5. There is no (that 
I can think of) reengineering of the core code --  I was zealous about 
not "cheating" with hacks to the core, and think I did fairly well.

Hope this is more useful.

dc



More information about the hackers mailing list