Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics
Stefan van den Dungen Gronovius
Developer

The only way to do this is by using the following filter to alter the value:

https://www.admincolumns.com/documentation/filter-reference/ac-column-value/

Based on your screenshot, something like the following snippet should work.

/**
 * @param $value  string
 * @param $id     int
 * @param $column AC_Column
 */
function ac_column_value_excluded_pages( $value, $id, $column ) {
	if ( $column instanceof ACP_Column_CustomField ) {
		$meta_key = $column->get_meta_key(); // This gets the Custom Field key

		if ( '_fl_theme_builder_exclusions' == $meta_key ) {
			$records = explode( ', ', $value );
			$results = array();

			foreach ( $records as $record ) {
				$parts = explode( ':', $record );

				// Define the parts of the URL as variables
				$meta_type = $parts[0];
				$post_type = $parts[1];
				$id = $parts[2];

				$result = $id;

				// If it is a (custom) post type, we can create a link with the title for it
				if ( 'post' === $meta_type ) {
					$result = ac_helper()->html->link( get_edit_post_link( $id ), get_the_title( $id ) );
				}

				$results[] = $result;

			}

			// Remove empty records
			$results = array_filter( $results );

			$value = implode( '<br>', $results );
		}
	}

	return $value;
}

add_filter( 'ac/column/value', 'ac_column_value_excluded_pages', 10, 3 );
6 years, 6 months ago

You must be logged in to reply to this topic.