Support » Plugin: Admin Columns » [Plugin: Codepress Admin Columns] Post Title with custom field type

  • Resolved lukewarmmizer


    Is it possible to display the Post Title with a custom field type in the same way that you can choose a field type for a custom field? I don’t see an obvious way to do this, but in my case I would like to display the Post Title as just a link that says “Edit”- for the post type in question the title has little value (it’s really the custom fields that have the important info), but hiding the title loses the link to edit the post. Perhaps the ability to choose standard fields as well as custom fields with a non-standard field type?


Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Codepress


    Ok, let me check if I understand this correctly. So you would like to select the custom field type which describes the input, so let’s say Post ID. And then control which output will be displayed, so in your case it would be the edit-link to your post(type), instead of the Post Title which is the default. But this could also be the post’s author, number of comments, post date, edit-link etc etc. Correct?

    I can see why this would be a nice addition as long is it won’t get to complicated to configure. I am trying to keep it as simple as possible without comprimising it’s versatility too much.

    Perhaps I should make a votebox or something, so I can see which feature I should focus one next, because the list of requested features is getting quite long 🙂

    I think you more or less have it, but I suppose simpler way of saying it would be to have a hook that allows for arbitrary info to be shown for a post based on some of the default post fields (ID, title, author, etc).

    As an example, I currently have a custom “user_id” field, but rather than showing the ID there is a hook in place to show the username that is associated with that ID. It would be pretty cool to be able to hook in to the post ID or other fields as well – to do a lookup for “something” that is keyed on that post ID.

    A work around that I came up with is to just save the post_id to a custom field using the save_post hook (save the post_ID as the_post_id for example) and then use that custom field to do the lookup as above using a hook/filter

    No pressure though, a votebox is probably the most democratic way to decide what your efforts go towards first. I promise you won’t hear any complaints from me 🙂


    Plugin Author Tobias Schutter


    That would be much simpeler indeed… Well as long as you know a little bit of coding 🙂

    But this hook has been long on my list, and I will be adding it to the next release v1.4.6.3. There was already a hook in place but that one did not pass sufficient variables to be of good use. So the new one will pass 2 additional variables.

    add_filter( 'cpac_get_column_value_custom_field', 'my_custom_field_value', 10, 5 );

    Filter explained:
    $value is the orignal value which would otherwise be displayed
    $internal_field_key is only used internally to store the column
    $custom_field is the name of your custom field
    $type will return either the posttype or if it is any other type it will return wp-comments, wp-links, wp-users, wp-media.
    $object_id will return the ID of the object.

    See following example:

    function my_custom_field_value( $value, $internal_field_key, $custom_field, $type, $object_id )
    	$my_post_type  = 'page';
    	$my_field_name = 'city';
    	// make sure we have the correct posttype and fieldname
    	if ( $my_post_type == $type && $my_field_name == $custom_field ) {
    		if ( '33' == $value )
    			$value = 'Amsterdam';
    		elseif ( '34' == $value )
    			$value = 'New York';
    	return $value;
    add_filter( 'cpac_get_column_value_custom_field', 'my_custom_field_value', 10, 5 );

    This will be in the FAQ section aswell. But now you have a good idea what to expect.

    The new release will be soon available.

    Plugin Author Codepress


    New release v1.4.6.3 is available. See the FAQ section for an example.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Codepress Admin Columns] Post Title with custom field type’ is closed to new replies.