• I’m using a custom field on my site. About the only serious drawback is that I can’t view it in the Manage Posts layout. I’d like to modify this layout so that the custom field gets displayed.

    There is one custom field entry (name of country) for every post on my site. I don’t use Categories, Comments, or Authors, so I’m thinking that I could use one of those columns for the custom field.

    1. Which is the source file for Manage Posts?
    2. Would I be tampering with the forces of nature if I simply replaced the table > field that is normally displayed in that column with wp_postmeta > meta_value?

    Thanks for any suggestions.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Just curious, but why don’t you put the countries as the categories instead of as a custom field?

    Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    I had written a plugin (heretofore unreleased) that allows you to do the above. I make no guarentees about it, but last I remember it worked. You can download the zip of it here. You can see the code for it here.

    Just unzip the .zip in your wp-content/plugins/ directory. Then edit it to identify (a) the custom fields you want to add to the “Manage Posts” page, and (b) the existing columns you want removed. Sorry, no admin screen for it at the moment.

    For example, using what you said, to add custom field to post listing, edit this variable like so:
    $custom_fields_to_show_in_listing = array(
    'country_name' => 'Country',
    );

    To remove existing columns (such as the author and category columns), change this relevent section:
    $listing_columns_to_remove = array('author', 'categories');

    Remember, you’re editing the plugin file to add/change the above code, not your templates or WP core files.

    Then, of course, activate the plugin.

    If you try it, let me know how (if) it works.

    Thread Starter hooopla

    (@hooopla)

    Just curious, but why don’t you put the countries as the categories instead of as a custom field?

    Long story. Basically, I’d be working with a list of potentially hundreds of categories. (And I’m not sure how the Create New Post layout would handle that!)

    Thread Starter hooopla

    (@hooopla)

    I had written a plugin (heretofore unreleased) that allows you to do the above.

    Well, coffee2code, fancy meeting you here! ??

    As it happens, in the few minutes between my first post and your reply in this thread, I used your wonderful Get Custom Field Value plugin to solve the problem, changing a core file (edit.php) to echo the value of the custom field.

    But I’d be a lot happier not messing with the core files, so I’m going to give Custom Fields in Admin Posts Listing a shot.

    Your plugins, BTW, are incredibly practical and really well documented. I’m sure there are a lot of happy coffee2code fans in WP Land. Thank you!

    Thread Starter hooopla

    (@hooopla)

    Fantastic! The Custom Fields in Admin Posts Listing plugin is exactly what I needed. (I hope you’ll keep that one in your repertoire and release it at some point.)

    Thanks again, c2c.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Viewing a custom field in Manage Posts layout’ is closed to new replies.