WordPress.org

Ready to get started?Download WordPress

Forums

customize post.php (5 posts)

  1. emsdc
    Member
    Posted 9 years ago #

    Requested feature: Admins should be able to customize post.php by (1) adding or deleting fields; and (2) renaming fields in the UI. For a site with multiple authors, the admin's changes to post.php would apply for all authors.
    In MT, I'm able to do this by hacking the edit page. It's difficult, but possible. Naturally, this would present some problems if I wanted to upgrade. But it's possible. In WordPress, because the page is generated by PHP (and because I don't yet know PHP), it looks like it would be very difficult to do this by editing post.php. It's a very large file and I'm not sure if even a good programmer could pull it off. I certainly can't.
    Flexibility with regard to customization of post.php would of course always be limited by the WP programmers' need to make assumptions about the type of data the user is likely to put in each field. There is currently a title field, extended entry, etc., and the WordPress programmers have to assume that the title field will hold a title, or something that has a similar role in a published document, or else the programmer wouldn't be able to structure the rest of the software to handle that type of data in appropriate ways.
    However, in a community site where the admin is working within the limits of WP's options and plugins to prepare a site that's as appropriate as possible for what the community wants to do, one can imagine many scenarios where the standard form won't suffice, and where changes to the form wouldn't necessarily break the logic of the whole program by stretching data types too much. The WP folks anticipated this to some extent by allowing creation of custom fields on a per-post basis, but that doesn't allow the admin to set up the UI in ways that are most hostpitable to the community. There are a lot of extra clicks involved (and typing) if all the members of the community have to set up the needed fields each time they post. So it would be fantastic if the admin could set up the custom fields and then lock the form so it will apply to all posts.
    I'm not a programmer so I don't know how difficult this would be. I imagine it might be somewhat difficult, and at first glance it might not seem like this capability would apply to enough blog sites to make it worthwhile. But I know that there are at least a couple posts on the WP form that ask for this, and some posts on MT forums as well. If you think about it, the design of the write/edit form really controls and limits, more than any other feature of the software, how WP will be used. I suspect a lot of people would think of more uses for the software on community websites if it were possible to excercise greater control over the UI for inputting stories, data, recipes, schedules -- and so on -- into one's database. In other words, since the write/edit form is how you add stuff to the database, the degree of flexibility that you have with regard to what you can do with WP, especially in multi-author community sites, is very much a function of the degree of control you have over the write/edit fields and field names. (Granted, changing the field names in the UI won't have any impact over how the database understands the fields, but that doesn't necessarily have to matter from the user's perspective.)
    Adding this capability would certainly give WP a huge edge over other blog/community software. Thoughts?

  2. ringmaster
    Member
    Posted 9 years ago #

    The post.php is pretty complicated, and perhaps the reason why you haven't been able to easily find the form fields in there is because they really aren't in that file.
    There are a couple of other files that post.php references, depending on the function that it's performing. If you're in advanced editing mode, it uses edit-form-advanced.php. If you're in basic editing mode, it uses edit-form.php.
    If you're going to edit these files for your site, my suggestion is to look for the id tags on each of the fieldsets (Use FireFox! The DOM Inspector rocks!) and then search for those ids in those two files.
    There is also a way to modify the look of those pages without changing any of the existing code. A lot about the way that the edit posts page is displayed can be modified using javascript and the DOM after the page is rendered.
    For example, if you just wanted to change the legend on the "Post" field to read "Type here:", you could add javascript to that page to set the text content of the a tag inside the first legend tag inside the fieldset with the ID "postcontent".
    You could rearrange, delete, or re-color any of the form elements fairly easily this way. Create a simple plugin that adds this code to the footer of the admin pages, and you would have code that won't get overwritten when you upgrade WordPress, and would likely continue to work.

  3. emsdc
    Member
    Posted 9 years ago #

    Excellent. Thanks very much.

  4. Anonymous
    Unregistered
    Posted 9 years ago #

    If you just want to relable the fields themselves, you can create a custom language file with PoEdit and change the wordpress language setting.. Check out the internationalization instructions.. :)

  5. emsdc
    Member
    Posted 9 years ago #

    Just thinking about this a bit more... Ringmaster's suggestions should be sufficient for my current project. In MT I misuse one of the entry fields, I forget which one, to give myself an extra field to display with each entry. (By the way, the MT key values plugin doesn't allow for this because you're actually indicating your use of the key values in one of the given fields every time you post, which is more time-intensive and harder to explain to other authors.) In WP it looks like I can misuse the excerpt field for that same purpose. And since I know I won't need an excerpt, this is sufficient for my project.
    However, I'm wondering if it's possible for WP's programmers to build a few extra fields for posts into the next release. These would be fields that aren't used in WP's stock interface, but that are built into the database on installation so that folks like myself who want to mess with the interface can do so. That is, a few database fields that will remain empty for most users -- I assume this doesn't really make the database more resource intensive, or cause any other problems -- but for oddballs like myself who want to add fields to the entry form, those spaces will already be reserved in the database.
    If I knew more about database administration and SQL maybe I could do this myself to my current database? Could I? Thanks...

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.