AWSM Team Shortcode

Below, you’ll find a detailed guide on how to add the AWSM Team – Team Showcase Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the AWSM Team – Team Showcase Plugin shortcode not to show or not to work correctly.

Before starting, here is an overview of the AWSM Team – Team Showcase Plugin and the shortcodes it provides:

Plugin Icon
AWSM Team – Team Showcase Plugin

"Plugin Name is AWSM Team – Team Showcase Plugin. This plugin allows you to display your team members in a stylish and interactive manner on your WordPress site. Perfect for showcasing your team's expertise and skills."

★★★★✩ (5) Active Installs: 4000+ Tested with: 6.3.2 PHP Version: 5.6
Included Shortcodes:
  • [awsmteam]

AWSM Team [awsmteam] Shortcode

The ‘awsmteam’ shortcode is used to display a specific team on your WordPress site. It works by taking an ‘id’ attribute, which corresponds to the team you want to display. This shortcode retrieves team details from the ‘awsm_team’ post type. If no team or members are found, it returns an error message. If found, it loads the corresponding team template from the plugin’s ‘templates’ directory.

Shortcode: [awsmteam]

Parameters

Here is a list of all possible awsmteam shortcode parameters and attributes:

  • id – Used to specify the unique identifier of the team

Examples and Usage

Basic example – A shortcode that displays a team by referencing its ID.

[awsmteam id=1 /]

Advanced examples

Using the shortcode to display a team by referencing its ID, and also specifying the order of team members by their IDs. The team will first try to load by team ID, and then the team members will be ordered according to the specified IDs.

[awsmteam id=1 memberlist="3,1,2" /]

Using the shortcode to display a team by referencing its ID, and also specifying the team style template. The team will first try to load by team ID, and then the team style will be applied according to the specified template.

[awsmteam id=1 team-style="template1" /]

Please note that in these examples, you need to replace the numbers and ‘template1’ with your actual team ID, member IDs, and template name.

PHP Function Code

In case you have difficulties debugging what causing issues with [awsmteam] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'awsmteam', array( $this, 'awsmteam_shortcode' ) );

Shortcode PHP function:

function awsmteam_shortcode( $atts ) {
			$shortcode_atts = shortcode_atts(
				array(
					'id' => false,
				),
				$atts,
				'awsmteam'
			);
			$id             = $shortcode_atts['id'];
			$options        = $this->get_options( 'awsm_team', $id );
			if ( ! $options ) {
				return '<div class="awsm-team-error">' . esc_html__( 'Team not found', 'awsm-team' ) . '</div>';
			}
			if ( empty( $options['memberlist'] ) ) {
				return '<div class="awsm-team-error">' . esc_html__( 'No members found', 'awsm-team' ) . '</div>';
			}
			$template = $this->settings['plugin_path'] . 'templates/' . $options['team-style'] . '.php';
			if ( file_exists( $template ) ) {
				ob_start();
				$teamargs = array(
					'orderby'        => 'post__in',
					'post_type'      => 'awsm_team_member',
					'post__in'       => $options['memberlist'],
					'posts_per_page' => -1,
				);
				$team     = new WP_Query( $teamargs );
				include $template;
				wp_reset_postdata();
				return ob_get_clean();
			}
		}

Code file location:

awsm-team/awsm-team/awsm-team.php

Conclusion

Now that you’ve learned how to embed the AWSM Team – Team Showcase Plugin shortcode, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *