Team Free Shortcode

Below, you’ll find a detailed guide on how to add the Team Free 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 Team Free Plugin shortcode not to show or not to work correctly.

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

Plugin Icon
WP Team – Best Team Members Showcase Plugin for WordPress

"WP Team – Best Team Members Showcase Plugin for WordPress is a dynamic solution to display your team in style. This plugin allows you to create, organize and customize your team members' profiles seamlessly."

★★★★☆ (73) Active Installs: 5000+ Tested with: 6.3.2 PHP Version: false
Included Shortcodes:
  • [wpteam]

Team Free [wpteam] Shortcode

The Team Free plugin shortcode enables the dynamic display of team member profiles on a WordPress site. Shortcode Name: The ‘wpteam’ shortcode fetches data from the ‘sptp_generator’ post type, checks its status, and retrieves layout and setting details. It enqueues necessary stylesheets and dynamically loads styles based on the layout and settings.

Shortcode: [wpteam]

Parameters

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

  • id – It is the unique identifier for the shortcode generator

Examples and Usage

Basic example – Utilizes the shortcode to display a team layout by referencing its ID.

[wpteam id=1 /]

Advanced examples

Embedding the team layout by referencing its ID and adding additional parameters for customization. In this example, the shortcode will display a team layout with ID 2 and apply custom styles, fonts, and other settings based on the parameters provided.

[wpteam id=2 style="modern" font="Arial" color="blue" /]

Using the shortcode to display a team layout by referencing both ID and title. The layout will first try to load by ID, but if not found, it will try to load by title.

[wpteam id=3 title="Marketing Team" /]

Please note that the actual parameters and their values will depend on the exact configuration of the ‘wpteam’ shortcode within your WordPress setup. Always refer to the specific documentation or code comments for accurate usage instructions.

PHP Function Code

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

Shortcode line:

add_shortcode( 'wpteam', array( $this, 'sptp_shortcode_func' ) );

Shortcode PHP function:

function sptp_shortcode_func( $attributes ) {

		$generator_id = esc_attr( intval( $attributes['id'] ) );
		// Check the shortcode status and post type.
		if ( empty( $generator_id ) || 'sptp_generator' !== get_post_type( $generator_id ) || 'trash' === get_post_status( $generator_id ) ) {
			return;
		}
		// Preset Layouts.
		$layout = get_post_meta( $generator_id, '_sptp_generator_layout', true );
		// All the visible options for the Shortcode like – Global, Filter, Display, Popup, Typography etc.
		$settings = get_post_meta( $generator_id, '_sptp_generator', true );
		if ( ! is_array( $settings ) ) {
			return; // for auto draft, broken shortcode
		}
		$main_section_title = get_the_title( $generator_id );

		$get_page_data      = self::get_page_data();
		$found_generator_id = $get_page_data['generator_id'];
		ob_start();
		// This shortcode id not in page id option. Enqueue stylesheets in shortcode.
		if ( ! is_array( $found_generator_id ) || ! $found_generator_id || ! in_array( $generator_id, $found_generator_id ) ) {
			wp_enqueue_style( 'team-free-swiper' );
			wp_enqueue_style( 'team-free-fontawesome' );
			wp_enqueue_style( SPT_PLUGIN_SLUG );
			// Dynamic style load.
			$dynamic_style = self::load_dynamic_style( $generator_id, $layout, $settings );
			echo '<style id="team_free_dynamic_css' . $generator_id . '">' . $dynamic_style['dynamic_css'] . '</style>';//phpcs:ignore
		}
		// Update options if the existing shortcode id option not found.
		self::db_options_update( $generator_id, $get_page_data );
		Helper::sptp_html_show( $generator_id, $layout, $settings, $main_section_title );
		return ob_get_clean();
	}

Code file location:

team-free/team-free/src/Frontend/Frontend.php

Conclusion

Now that you’ve learned how to embed the Team Free 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 *