Current File : /home/kelaby89/www/wp/wp-content/plugins/trx_addons/components/cpt/testimonials/testimonials-sc.php
<?php
/**
 * ThemeREX Addons Custom post type: Testimonials (Shortcodes)
 *
 * @package ThemeREX Addons
 * @since v1.2
 */

// Don't load directly
if ( ! defined( 'TRX_ADDONS_VERSION' ) ) {
	exit;
}


// trx_sc_testimonials
//-------------------------------------------------------------
/*
[trx_sc_testimonials id="unique_id" type="default" cat="category_slug or id" count="3" columns="3" slider="0|1"]
*/
if ( !function_exists( 'trx_addons_sc_testimonials' ) ) {
	function trx_addons_sc_testimonials($atts, $content = '') {	

		// Exit to prevent recursion
		if (trx_addons_sc_stack_check('trx_sc_testimonials')) return '';

		$atts = trx_addons_sc_prepare_atts( 'trx_sc_testimonials', $atts, trx_addons_sc_common_atts( 'trx_sc_testimonials', 'id,title,slider,query', array(
			// Individual params
			"type" => "default",
			"use_initials" => false,
			"rating" => 0
		) ) );

		$atts['rating'] = max(0, min(1, (int) $atts['rating']));
		if (!empty($atts['ids'])) {
			if ( is_array( $atts['ids'] ) ) {
				$atts['ids'] = join(',', $atts['ids']);
			}
			$atts['ids'] = str_replace(array(';', ' '), array(',', ''), $atts['ids']);
			$ids_count = count( explode( ',', $atts['ids'] ) );
			if ( empty( $atts['count'] ) || $atts['count'] >= $ids_count || empty( $atts['pagination'] ) || trx_addons_is_off( $atts['pagination'] ) ) {
				$atts['count'] = $ids_count;
			}
		}
		$atts['count'] = max(1, (int) $atts['count']);
		$atts['offset'] = max(0, (int) $atts['offset']);
		if (empty($atts['orderby'])) $atts['orderby'] = 'date';
		if (empty($atts['order'])) $atts['order'] = 'desc';
		$atts['slider'] = max(0, (int) $atts['slider']);
		if ($atts['slider'] > 0 && (int) $atts['slider_pagination'] > 0) $atts['slider_pagination'] = 'bottom';

		// Load CPT-specific scripts and styles
		trx_addons_cpt_testimonials_load_scripts_front( true );

		// Load template
		ob_start();
		trx_addons_get_template_part(array(
										TRX_ADDONS_PLUGIN_CPT . 'testimonials/tpl.'.trx_addons_esc($atts['type']).'.php',
										TRX_ADDONS_PLUGIN_CPT . 'testimonials/tpl.default.php'
										),
										'trx_addons_args_sc_testimonials',
										$atts
									);
		$output = ob_get_contents();
		ob_end_clean();
		
		return apply_filters('trx_addons_sc_output', $output, 'trx_sc_testimonials', $atts, $content);
	}
}


// Add shortcode [trx_sc_testimonials]
if (!function_exists('trx_addons_sc_testimonials_add_shortcode')) {
	function trx_addons_sc_testimonials_add_shortcode() {
		add_shortcode("trx_sc_testimonials", "trx_addons_sc_testimonials");
	}
	add_action('init', 'trx_addons_sc_testimonials_add_shortcode', 20);
}
Page not found – Hello World !