/** * Add output for custom columns on the "menu items" screen. * * @since 1.0.0 * @param string $column The name of the column to display. * @param int $post_id The ID of the current post. */ public function manage_testimonial_columns($column, $post_id) { require_once CHERRY_TESTI_DIR . 'public/includes/class-cherry-testimonials-template-callbacks.php'; $callbacks = new Cherry_Testimonials_Template_Callbacks(null); switch ($column) { case 'author_name': $name = $callbacks->get_name(); echo empty($name) ? '—' : $name; break; case 'thumbnail': $avatar = $callbacks->get_avatar(); echo empty($avatar) ? '—' : $avatar; break; case 'position': $position = $callbacks->get_position(); echo empty($position) ? '—' : $position; break; case 'company_name': $company_name = $callbacks->get_company(); echo empty($company_name) ? '—' : $company_name; break; default: break; } }
/** * Add testimonials macros data to process it in carousel shortcode. * * @since 1.0.2 * @param array $postdata Default data. * @param int $post_id Processed post ID. * @param array $atts Shortcode attributes. */ public function add_carousel_data($postdata, $post_id, $atts) { require_once CHERRY_TESTI_DIR . 'public/includes/class-cherry-testimonials-template-callbacks.php'; $callbacks = new Cherry_Testimonials_Template_Callbacks($atts); $postdata['testiavatar'] = $callbacks->get_avatar(); $postdata['testicontent'] = $callbacks->get_content(); $postdata['testiauthor'] = $callbacks->get_author(); $postdata['testiemail'] = $callbacks->get_email(); $postdata['testiname'] = $callbacks->get_name(); $postdata['testiurl'] = $callbacks->get_url(); $postdata['testiposition'] = $callbacks->get_position(); $postdata['testicompany'] = $callbacks->get_company(); /** * Filters a fallback for old themes. * * @since 1.1.0 */ if (false === apply_filters('cherry_testimonials_remove_carousel_data_fallback', false)) { $postdata['author'] = $callbacks->get_author(); $postdata['email'] = $callbacks->get_email(); $postdata['url'] = $callbacks->get_url(); } return $postdata; }