• Note: I’ve searched and found an article on best practices, but it didn’t really apply to my particular situation.
    I’ve been a developer for years, so I want to know the best way to make changes to the code while also ensuring a fairly smooth upgrade path in the future.
    Generally, I try to do the following:

    • Change the CSS file whenever possible instead of PHP.
    • Add arguments to functions used in index.php instead of the individual ‘class’ files, like wp-includes/links.php. For example, the ‘get_links_list’ function has default parameters which I override in index.php instead of changing it in the function declaration or the function body.
    • Create a new file for custom PHP functions, which gets included at the beginning of index.php. This way, I can just move all my custom functions to a new version in one file.
    • Not create any tables in the database which might collide with the WP prefix

    These are all sort of common sense ideas, but can someone let me know if there is a better way to approach customizing wordpress, or if there will be a problem in the future with the above method. Hopefully when there is an upgrade, I can simply replace the directories, like wp-includes, check out the new index.php for new features, and be on my way.
    Thank you. And for what it’s worth, WordPress is truly a fantastic piece of software.
    (Though it would be even better if there was better security for commenters, but I’ll save that for a different forum)

Viewing 5 replies - 1 through 5 (of 5 total)
  • Well, items 1 & 2 are gimmies – at least I think so. One should use the CSS as much as possible, and you really shouldn’t be changing default parameter values, but overriding them by actually setting them in the index.php file.
    #3 is a good idea, another way to do that is to use the older my-hacks.php method, or create “plugin” that has the functions in it, then activate it.
    Letter 4 also goes with out saying. If I create tables I respect the wp table prefix, since the user could have multiple installs, but the table name would be tg_MyTable so that the full name would end up being wp_tg_mytable.
    They are common sense, but some times, that just goes right out the window…. I know I’m guilty of it.
    Good list though.
    TG

    How about instead of the practices let people know what the steps are to creating a template all your own? Should people design it as a site and plugin the php calls chopped outta the current wp index? What is the proper way to do this in DETAIL?
    step1?

    Well personally when I started using WP I threw the default index.php and wp-content.css out the window. This due to my pre-existing layout and dissatisfaction with various things in the default files. (Divs named rap bother me. its WRAP damnit…)
    upon upgrades I just make sure to exclude index and comments mostly. Then manually modify a few admin-lvl files that I change.

    Thread Starter doshin

    (@doshin)

    Okay, so I guess I’m okay then.
    Gravity, where you talking to me? I’ve only been using WordPress for a very short time, so I would be the least qualified person to give any sort of direction. I just wanted to make sure I wasn’t doing anything wrong.

    Off-topic:
    <quote>(Divs named rap bother me. its WRAP damnit…)</quote>
    Would you believe I never realised that name was supposed to make sense? Like “content” and “menu”?… Heh. I just thought it was some fancy technical acronym. Thanks for clearing that up. For some reason I now have more of a grasp of where the changes are, when I fiddle with this style in the css-file.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Best Practices for Customizing WordPress (PHP)’ is closed to new replies.