'; };
// render info panels
if ( $panel_is_on && ! $post_format_link ) {
$std_post_formats = in_array( $metaboxes['post_format'], array( false, 'qoute') );
// panel classes
$panel_classes = '{p}panel-align-' . $a['panel'];
$panel_classes .= ' {p}panel-pf-' . ( $metaboxes['post_format'] ? $metaboxes['post_format'] : 'standard' );
$panel_classes .= $sc_extra_class;
// determine image for the panel
if ( $metaboxes['post_format'] == 'image' && $metaboxes['panel-img'] ) {
$img_url = esc_attr( $metaboxes['panel-img'] );
// } else if ( $metaboxes['post_format'] == 'image' || $metaboxes['img-other-post-formats'] && $std_post_formats ) {
// $img_url = $image[0];
} else {
$img_url = $image[0];
}
$this->renderer->set_variables( $args + array(
'panel_id' => $panel_modal_id,
'panel_classes' => $panel_classes,
'panel' => $a['panel'],
'panel_img' => esc_attr( $img_url ),
'std_post_formats' => $std_post_formats,
'content' => apply_filters( 'the_content', get_the_content() ),
'code-block' => ( ! empty( $metaboxes['code-block'] ) )
? $this->plugin_public->remove_tags_and_attributes_from_html( $metaboxes['code-block'], array( 'script' ) )
: false, // code-block
) );
$panels_html .= $this->renderer->render( 'panel' );
} // panel_is_on
if ( $last_post ) { $panels_html .= '
'; };
} // IF has_post_thumbnail
endwhile; endif;
wp_reset_postdata(); // End $sc_query LOOP
/* ';
// Output shortcode's HTML
return $thumbs_html . $panels_html;
} // team_or_member_loop | FNC
/**
* Highlights certain word (designated by %word%), by wrapping it in
*
* @since 1.0.0
*/
private function highlight_word( $string, &$unhighlight_string = false ) {
if ( $unhighlight_string ) $unhighlight_string = str_replace( '%', '', $unhighlight_string);
return preg_replace('/%([^%]+)%/', '$1', $string );
// $str_array = explode( ' ', $string );
// $last_word = ' ' . array_pop($str_array) . '';
// return join( ' ', $str_array ) . $last_word;
} // FNC
/*-------------------------------------------------------------------
▐ 1. TEAM SHORTCODE
--------------------------------------------------------------------*/
public function sc_amoteam( $atts ) {
// Attributes
$a = shortcode_atts(
array(
'max' => 50,
'categories' => false,
'item-width' => '250',
'full-width' => 'yes',
'item-margin' => '20',
'panel' => 'right',
'align' => false, // not present in the SC
'style' => false, // not present in the SC
'class' => '', // not present in the SC
), $atts );
/* SANITIZATION
-------------------------------------------------------------------*/
// Prevent max number of members be more than 50
if ( $a['max'] > 50) { $a['max'] = 50; }
/* PREPARATION
-------------------------------------------------------------------*/
// enqueue scripts needed for plugin's shortcode
$this->plugin_public->enqueue_public_scripts_on_demand();
// initiate render dependencies
$this->gpo->render_dependencies( $this, true );
// if categories are set in the shortcode
$categories = $a['categories'] ? array(
array(
'taxonomy' => 'amo-team-category',
'terms' => explode( ',', $a['categories'] ),
),
) : '';
// Team query arguments
$team_query_args = array(
'post_type' => 'amo-team',
'posts_per_page' => $a['max'],
'tax_query' => $categories,
);
/* LOOP AND OUTPUT
-------------------------------------------------------------------*/
return $this->team_or_member_loop('team', $a, $team_query_args );
} // amoteam | SHORTCODE
/*-------------------------------------------------------------------
▐ 2. MEMBER SHORTCODE
--------------------------------------------------------------------*/
public function sc_amo_member( $atts ) {
// Attributes
$a = shortcode_atts(
array(
'id' => false,
'item-width' => '250',
'item-margin' => '20',
'full-width' => 'yes',
'panel' => 'right',
'align' => false,
'style' => false, // not present in the SC
'class' => '', // not present in the SC
), $atts );
/* SANITIZATION
-------------------------------------------------------------------*/
// If post id is empty, return
if ( ! $a['id'] ) return false;
// Prepare id/ids for WP query
$a['id'] = explode( ',', $a['id'] );
// Full-Width and item-margin parameters allowed only,
// when more than one member/post in the shortcode block
if ( count( $a['id'] ) < 2 ) {
$a['item-margin'] = 0;
$a['full-width'] = 'no';
}
/* PREPARATION
-------------------------------------------------------------------*/
// enqueue scripts needed for plugin's shortcode
$this->plugin_public->enqueue_public_scripts_on_demand();
// initiate render dependencies
$this->gpo->render_dependencies( $this, true );
// Team query arguments
$team_query_args = array(
'post_type' => 'amo-team',
'post__in' => $a['id'],
);
/* LOOP AND OUTPUT
-------------------------------------------------------------------*/
return $this->team_or_member_loop( 'member', $a, $team_query_args );
} // amo_member | SHORTCODE
/*-------------------------------------------------------------------
▐ 3. TEXT BLOCK SHORTCODE
--------------------------------------------------------------------*/
function sc_amo_text_block( $atts, $content = "" ) {
// Attributes
$a = shortcode_atts(
array(
'title' => '',
'subtitle' => '',
'class' => '', // not present in the SC
), $atts );
/* Prepare variables for the template
-------------------------------------------------------------------*/
if ( $a['subtitle'] ) {
$a['subtitle'] = $this->highlight_word( $a['subtitle'], $a['title'] );
} else {
$a['title'] = $this->highlight_word( $a['title'], $a['subtitle'] );
$a['class'] .= ' {p}panel-sc-only-title';
} // IF is subtitle
/* Prepare to render the template
-------------------------------------------------------------------*/
// enqueue scripts needed for plugin's shortcode
$this->plugin_public->enqueue_public_scripts_on_demand();
// initiate render dependencies
$this->gpo->render_dependencies( $this, true );
// render the shortcode
$this->renderer->set_variables( array(
'title' => $a['title'],
'subtitle' => $a['subtitle'],
'class' => $a['class'],
'content' => $content,
) );
$html = $this->renderer->render( 'sc-text-block' );
return $html;
} // amo_bio | SHORTCODE
/*-------------------------------------------------------------------
▐ 3. SKILLS SHORTCODE
--------------------------------------------------------------------*/
function sc_amo_skills( $atts, $content = "" ) {
// Attributes
$a = shortcode_atts(
array(
'title' => '',
'class' => '', // not present in the SC
), $atts );
/* Prepare to render the template
-------------------------------------------------------------------*/
// enqueue scripts needed for plugin's shortcode
$this->plugin_public->enqueue_public_scripts_on_demand();
// initiate render dependencies
$this->gpo->render_dependencies( $this, true );
// render the shortcode
$this->renderer->set_variables( array(
'title' => $a['title'],
'class' => $a['class'],
'content' => do_shortcode( $content ),
) );
$html = $this->renderer->render( 'sc-skills' );
return $html;
} // amo_bio | SHORTCODE
/*-------------------------------------------------------------------
▐ 4. SINGLE SKILL SHORTCODE
--------------------------------------------------------------------*/
function sc_amo_single_skill( $atts ) {
// Attributes
$a = shortcode_atts(
array(
'title' => '',
'percent' => '',
'class' => '', // not present in the SC
), $atts );
/* Prepare to render the template
-------------------------------------------------------------------*/
$html = '';
if ( is_object( $this->renderer ) ) {
// render the shortcode
$this->renderer->set_variables( array(
'title' => $a['title'],
'percent' => $a['percent'],
'class' => $a['class'],
) );
$html = $this->renderer->render( 'sc-skills-single' );
}
return $html;
} // amo_single_skill | SHORTCODE
} // CLASS