Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics
Thomas

Column with a link

Hi

Im using the pro version.

I want to add a column with an external link. no I want to add to this link the recent post-id, for exampl http://www.sample.com?mypost=POST-ID . How can I add such a custom row? With the type “link”? But how I can add then the post id?

thanks a lot for your answer.

Thomas

5 years ago
Stefan
Developer

Since we have no custom column for that you have to alter the value for your column yourself.
So say you use the custom field column, you can setup the column as normal.
Next, you can use this filter in your code to change the value

cac/column/meta/value

For example, if you have a custom field that returns the ID that you want to use in your URL, you can do something like this.

function my_column_meta_value_create_link( $value, $object_id, $column ) { 
  $custom_field_key = 'this_is_your_custom_key'; 
  if ( 'column-meta' == $column->get_type() && $custom_field_key == $column->get_field() ) { 
    $value = 'http://www.sample.com?mypost=' . $value; 
  } 
  return $value; 
} 
add_filter( 'cac/column/meta/value', 'my_column_meta_value_create_link', 10, 3 );

It adds the current value (ID) to the string (website) that you choose.
Hopefully this make sense. If you have any questions, please let me know.

5 years ago

You must be logged in to reply to this topic.