Inventory_Presser_Template_Provider::return_post_content_as_vehicle_description( mixed $value, int $object_id, string $meta_key )
Returns the post content as part of the vehicle description.
On This Page
Parameters Parameters
- $value
-
(mixed) (Required) The value of the metadata.
- $object_id
-
(int) (Required) The ID of the object the metadata is for.
- $meta_key
-
(string) (Required) The meta key.
Return Return
(mixed) null or array
Source Source
File: includes/class-template-provider.php
public function return_post_content_as_vehicle_description( $value, $object_id, $meta_key ) {
if ( ! empty( $value ) ) {
return $value;
}
if ( apply_filters( 'invp_prefix_meta_key', 'description' ) !== $meta_key ) {
return $value;
}
// Is this setting enabled?
$settings = INVP::settings();
if ( ! isset( $settings['provide_templates'] ) || ! $settings['provide_templates'] ) {
// No.
return $value;
}
if ( INVP::POST_TYPE !== get_post_type( $object_id ) ) {
return $value;
}
ob_start();
the_content( null, false, $object_id );
$content = ob_get_clean();
if ( empty( $content ) ) {
return $value;
}
return array( $content );
}
Expand full source codeCollapse full source codeView on Github