Powerkit Shortcodes

Below, you’ll find a detailed guide on how to add the Powerkit Shortcodes to your WordPress website, including their parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Powerkit Plugin shortcodes not to show or not to work correctly.

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

Plugin Icon
Powerkit – Supercharge your WordPress Site

"Powerkit is a robust tool designed to supercharge your WordPress site. This plugin offers a plethora of features to optimize your website's performance and enhance user experience. Powerkit is your ultimate site booster."

★★★★☆ (14) Active Installs: 20000+ Tested with: 6.3.2 PHP Version: 5.4
Included Shortcodes:
  • [powerkit_shortcode]
  • [powerkit_row]
  • [powerkit_col]
  • [powerkit_facebook_fanpage]
  • [powerkit_posts]
  • [powerkit_instagram]
  • [powerkit_subscription_form]
  • [powerkit_pinterest_board]
  • [powerkit_pinterest_profile]
  • [powerkit_share_buttons]
  • [powerkit_social_link]
  • [powerkit_social_links]
  • [powerkit_toc]
  • [powerkit_twitter_feed]

Powerkit [powerkit_shortcode] Shortcode

The Powerkit shortcode is a powerful tool that enables the display of customized content on your site. It operates by retrieving all shortcodes and their default attributes. It then merges these attributes with user-defined ones, applies any nested shortcodes within the content, and finally, filters the HTML output. This allows for a highly flexible and personalized content presentation. Shortcode: [shortcode_display]

Shortcode: [powerkit_shortcode]

Parameters

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

Based on the provided code, it appears there are no specific shortcode parameters defined. Therefore, the appropriate text would be:

NO_PARAMS

Examples and Usage

Basic example – The shortcode displays a table with a specified ID from your database.

[powerkit_shortcode base='table' id=1 /]

PHP Function Code

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

Shortcode line:

add_shortcode( $section['base'], array( $this, 'shortcode_display' ) );

Shortcode PHP function:

function shortcode_display( $atts, $content = false, $shortcode = '' ) {
		// Get all shortcodes.
		$sections = apply_filters( 'powerkit_basic_shortcodes_ui_args', array() );

		// Get Default Attrs.
		$default_attrs = array();
		foreach ( $sections as $section ) {
			if ( isset( $section['fields'] ) && is_array( $section['fields'] ) ) {
				foreach ( $section['fields'] as $field ) {
					switch ( $field['type'] ) {
						case 'section':
							break;
						case 'repeater':
							if ( $field['base'] === $shortcode ) {
								foreach ( $field['fields'] as $repeater_field ) {
									$default_attrs[ $repeater_field['name'] ] = $repeater_field['default'] ? $repeater_field['default'] : '';
								}
							}
							break;
						default:
							if ( $section['base'] === $shortcode ) {
								$default_attrs[ $field['name'] ] = $field['default'] ? $field['default'] : '';
							}
							break;
					}
				}
			}
		}

		// Merge Attrs.
		$atts = shortcode_atts( $default_attrs, $atts );

		// Content.
		$content = do_shortcode( $content );

		/**
		 * Filters a shortcode's HTML.
		 *
		 * @param array  $output    Shortcode HTML.
		 * @param array  $atts      User defined attributes in shortcode tag.
		 * @param string $content   Shorcode tag content.
		 * @return string           Shortcode result HTML.
		 */
		$output = apply_filters( $shortcode . '_shortcode', '', $atts, $content );

		return $output;
	}

Code file location:

powerkit/powerkit/modules/basic-elements/public/class-powerkit-basic-elements-public.php

Powerkit [powerkit_row] Shortcode

The Powerkit Row shortcode is a dynamic tool for WordPress. It allows you to create a row within your content, where you can include additional shortcodes or text. The PHP function ‘add_row_shortcode’ initiates the shortcode, creating a new section in your post enclosed by a div tag. The content within this section can be filtered and modified as per your needs.

Shortcode: [powerkit_row]

Examples and Usage

Basic example – The shortcode ‘powerkit_row’ is used to create a row in your post or page content. It accepts the content that you want to display inside the row as its parameter.

[powerkit_row]Your content goes here[/powerkit_row]

PHP Function Code

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

Shortcode line:

add_shortcode( 'powerkit_row', array( $this, 'add_row_shortcode' ) );

Shortcode PHP function:

function add_row_shortcode( $atts, $content ) {
		ob_start();
		?>
			<div class="pk-row">
				<?php
				$row_content = apply_filters( 'powerkit_the_row_content', $content, $atts );

				if ( apply_filters( 'powerkit_render_shortcodes_in_row', true, $content, $atts ) ) {
					echo do_shortcode( $row_content );
				} else {
					echo $row_content; // XSS.
				}
				?>
			</div>
		<?php
		return ob_get_clean();
	}

Code file location:

powerkit/powerkit/modules/basic-elements/templates/grid.php

Powerkit [powerkit_col] Shortcode

The Powerkit Column shortcode is used to create a responsive column layout in WordPress. It accepts ‘size’ as an attribute to define the column width. The shortcode content is processed and displayed within the column. It also supports nested shortcodes, providing flexibility in content presentation.

Shortcode: [powerkit_col]

Parameters

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

  • size – Determines the width of the column in the grid system

Examples and Usage

Basic example – A simple usage of the shortcode to create a column with a default size of 1.

[powerkit_col /]

Advanced examples

Using the shortcode to create a column with a specified size. In this case, the size of the column is set to 3.

[powerkit_col size=3 /]

Using the shortcode to create a column with a specified size and content. The content of the column is set to ‘Hello, world!’

[powerkit_col size=3]Hello, world![/powerkit_col]

Using the shortcode to create a column with a specified size and content, and applying additional shortcodes within the column. The content of the column is set to ‘Hello, world!’, and a button shortcode is also applied within the column.

[powerkit_col size=3]Hello, world! [button][/powerkit_col]

PHP Function Code

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

Shortcode line:

add_shortcode( 'powerkit_col', array( $this, 'add_column_shortcode' ) );

Shortcode PHP function:

function add_column_shortcode( $atts, $content ) {
		$size = 1;
		if ( ! empty( $atts['size'] ) ) {
			$size = (int) $atts['size'];
		}

		ob_start();
		?>
			<div class="pk-col-md-<?php echo esc_attr( $size ); ?>">
				<?php
				$column_content = apply_filters( 'powerkit_the_column_content', $content, $atts );

				if ( apply_filters( 'powerkit_render_shortcodes_in_column', true, $content, $atts ) ) {
					echo do_shortcode( $column_content );
				} else {
					echo $column_content; // XSS.
				}
				?>
			</div>
		<?php
		return ob_get_clean();
	}

Code file location:

powerkit/powerkit/modules/basic-elements/templates/grid.php

Powerkit [powerkit_facebook_fanpage] Shortcode

The Powerkit Facebook Fanpage shortcode is a tool that enables WordPress users to embed a Facebook fan page on their website. This shortcode allows customization of the fan page display, with parameters for hiding the cover photo, showing facepile, showing posts, and adapting the container width. It also includes a small header option. If the ‘href’ parameter is not provided, a warning message is displayed.

Shortcode: [powerkit_facebook_fanpage]

Parameters

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

  • href – is the URL of the Facebook Fanpage
  • hide_cover – determines whether to hide the cover photo or not
  • show_facepile – decides if the profile photos of fans are displayed
  • show_posts – controls whether posts from the Fanpage are shown
  • small_header – indicates if a smaller header should be used
  • adapt_container_width – ensures the plugin adjusts to the width of its container

Examples and Usage

Basic example – Display a Facebook fanpage using the shortcode. This example uses only the ‘href’ parameter to specify the URL of the Facebook page.

[powerkit_facebook_fanpage href="https://www.facebook.com/yourpage/"]

Advanced examples

Display a Facebook fanpage with a small header and hiding the page’s cover image. The ‘small_header’ and ‘hide_cover’ parameters are set to ‘true’.

[powerkit_facebook_fanpage href="https://www.facebook.com/yourpage/" small_header="true" hide_cover="true"]

Display a Facebook fanpage with facepile and posts. The ‘show_facepile’ and ‘show_posts’ parameters are set to ‘true’.

[powerkit_facebook_fanpage href="https://www.facebook.com/yourpage/" show_facepile="true" show_posts="true"]

Display a Facebook fanpage with a small header, hiding the cover image, showing facepile and posts, and adapting the width to the container. All parameters are used in this example.

[powerkit_facebook_fanpage href="https://www.facebook.com/yourpage/" hide_cover="true" show_facepile="true" show_posts="true" small_header="true" adapt_container_width="true"]

PHP Function Code

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

Shortcode line:

add_shortcode( 'powerkit_facebook_fanpage', 'powerkit_facebook_fanpage_shortcode' );

Shortcode PHP function:

function powerkit_facebook_fanpage_shortcode( $atts, $content = '' ) {

	$params = powerkit_shortcode_atts( shortcode_atts( array(
		'href'                  => '',
		'hide_cover'            => false,
		'show_facepile'         => false,
		'show_posts'            => false,
		'small_header'          => false,
		'adapt_container_width' => true,
	), $atts ) );

	$params['hide_cover']            = filter_var( $params['hide_cover'], FILTER_VALIDATE_BOOLEAN );
	$params['show_facepile']         = filter_var( $params['show_facepile'], FILTER_VALIDATE_BOOLEAN );
	$params['show_posts']            = filter_var( $params['show_posts'], FILTER_VALIDATE_BOOLEAN );
	$params['small_header']          = filter_var( $params['small_header'], FILTER_VALIDATE_BOOLEAN );
	$params['adapt_container_width'] = filter_var( $params['adapt_container_width'], FILTER_VALIDATE_BOOLEAN );

	ob_start();

	if ( $params['href'] ) {
	?>
		<div class="fb-page-wrapper">
			<div class="fb-page"
				 data-href="<?php echo esc_attr( $params['href'] ); ?>"
				 data-hide-cover="<?php echo esc_attr( $params['hide_cover'] ? 'true' : 'false' ); ?>"
				 data-show-facepile="<?php echo esc_attr( $params['show_facepile'] ? 'true' : 'false' ); ?>"
				 data-show-posts="<?php echo esc_attr( $params['show_posts'] ? 'true' : 'false' ); ?>"
				 data-small-header="<?php echo esc_attr( $params['small_header'] ? 'true' : 'false' ); ?>"
				 data-adapt-container-width="<?php echo esc_attr( $params['adapt_container_width'] ? 'true' : 'false' ); ?>">
			</div>
		</div>
	<?php
	} else {
		powerkit_alert_warning( esc_html__( 'The "Facebook Fanpage URL" field is required!', 'powerkit' ) );
	}

	return ob_get_clean();
}

Code file location:

powerkit/powerkit/modules/facebook/public/class-powerkit-facebook-fanpage-shortcode.php

Powerkit [powerkit_posts] Shortcode

The Powerkit Posts shortcode is designed to display posts inline on your WordPress site. It allows customization of the title, post count, offset, ID, category, tag, time frame, order, template, and image size. The shortcode pulls posts based on the specified attributes, with options for grid layouts of 2, 3, or 4 columns. It also excludes previously displayed posts, ensuring unique content each time.

Shortcode: [powerkit_posts]

Parameters

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

  • title – set a title for the post section.
  • count – determine the number of posts to display.
  • offset – skip a certain number of posts at the beginning.
  • ids – specify posts by their IDs.
  • category – filter posts by a specific category.
  • tag – filter posts by a specific tag.
  • time_frame – filter posts from a specific time period.
  • orderby – arrange posts by date, title, etc.
  • order – set post display order, ascending or descending.
  • template – choose a layout template for the posts.
  • image_size – determine the size of the post image.
  • exclude_posts – exclude certain posts from the display.

Examples and Usage

Basic example – Display a single post from a specific category.

[powerkit_posts count=1 category="news"]

Advanced examples

Display the latest three posts from a specific category, ordered by date in descending order.

[powerkit_posts count=3 category="news" orderby="date" order="DESC"]

Display posts with a specific tag, excluding the current post.

[powerkit_posts tag="featured" exclude_posts="true"]

Show four posts in a grid format, with a custom title, from a specific category.

[powerkit_posts count=4 template="grid-4" title="Featured News" category="news"]

Display posts from a specific time frame, ordered by popularity (number of comments).

[powerkit_posts count=5 time_frame="last_month" orderby="comment_count"]

PHP Function Code

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

Shortcode line:

add_shortcode( 'powerkit_posts', 'powerkit_inline_posts_shortcode' );

Shortcode PHP function:

function powerkit_inline_posts_shortcode( $atts, $content = '' ) {

	if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) {
		return;
	}

	global $post;

	ob_start();

	global $powerkit_inline_posts;

	// Attributes.
	$atts = powerkit_shortcode_atts( shortcode_atts( array(
		'title'         => '',
		'count'         => 1,
		'offset'        => 0,
		'ids'           => null,
		'category'      => null,
		'tag'           => null,
		'time_frame'    => null,
		'orderby'       => 'date',
		'order'         => 'DESC',
		'template'      => 'list',
		'image_size'    => 'pk-thumbnail',
		'exclude_posts' => $powerkit_inline_posts,
	), $atts ) );

	$posts = powerkit_get_inline_posts( $atts );

	$columns  = 1;
	$template = $atts['template'];

	// Check grid template.
	switch ( $atts['template'] ) {
		case 'grid-2':
			$template = 'grid';
			$columns  = 2;
			break;
		case 'grid-3':
			$template = 'grid';
			$columns  = 3;
			break;
		case 'grid-4':
			$template = 'grid';
			$columns  = 4;
			break;
	}

	if ( $posts ) {
		?>
		<div class="pk-inline-posts">
			<?php
			$tag = apply_filters( 'powerkit_section_title_tag', 'h5' );

			if ( $atts['title'] ) {
			?>
				<<?php echo esc_html( $tag ); ?> class="pk-inline-posts-title pk-title pk-font-block">
					<?php echo esc_html( $atts['title'] ); ?>
				</<?php echo esc_html( $tag ); ?>>
			<?php } ?>

			<div class="pk-inline-posts-container pk-inline-posts-template-<?php echo esc_attr( $template ); ?>"
				data-columns="<?php echo esc_attr( $columns ); ?>">
				<?php
				foreach ( $posts as $post ) {

					setup_postdata( $post );
					// Exclude current post ID.
					$powerkit_inline_posts[] = $post->ID;

					// Output template.
					powerkit_inline_posts_template_handler( $atts['template'], $posts, $atts );
				}
				?>
			</div>
		</div>
		<?php
	}

	wp_reset_postdata();

	return ob_get_clean();
}

Code file location:

powerkit/powerkit/modules/inline-posts/public/class-powerkit-inline-posts-shortcode.php

Powerkit [powerkit_instagram] Shortcode

The Powerkit Instagram shortcode is a powerful tool for displaying Instagram posts on your WordPress site. It allows customization of the header, button, number of posts, columns, size, target, and template. With this shortcode, you can create a unique Instagram display tailored to your site’s needs.

Shortcode: [powerkit_instagram]

Parameters

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

  • header – Determines if the header is displayed or not.
  • button – Controls whether the button is shown or hidden.
  • number – Specifies the number of Instagram posts to display.
  • columns – Sets the number of columns for displaying the posts.
  • size – Defines the size of the Instagram posts.
  • target – Sets the target attribute for the Instagram links.
  • template – Determines the template used for displaying the posts.

Examples and Usage

Basic Example – The Powerkit Instagram shortcode displays the most recent Instagram posts. By default, it shows 4 posts in 1 column with small-sized images. The header and button are visible, and the links open in a new tab.

[powerkit_instagram]

Advanced Examples

Customizing the number of posts and their size. This shortcode will display 6 recent Instagram posts in a large size.

[powerkit_instagram number=6 size="large"]

Changing the number of columns and target. This shortcode will display the recent Instagram posts in 3 columns, and the links will open in the same tab.

[powerkit_instagram columns=3 target="_self"]

Modifying the template and hiding the header and button. This shortcode will display the recent Instagram posts using the ‘grid’ template without a header and button.

[powerkit_instagram header=false button=false template="grid"]

PHP Function Code

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

Shortcode line:

add_shortcode( 'powerkit_instagram', 'powerkit_instagram_shortcode' );

Shortcode PHP function:

function powerkit_instagram_shortcode( $atts, $content = '' ) {

	$params = powerkit_shortcode_atts( shortcode_atts( array(
		'header'   => true,
		'button'   => true,
		'number'   => 4,
		'columns'  => 1,
		'size'     => 'small',
		'target'   => '_blank',
		'template' => 'default',
	), $atts ) );

	ob_start();

	powerkit_instagram_get_recent( $params );

	return ob_get_clean();
}

Code file location:

powerkit/powerkit/modules/instagram/public/class-powerkit-instagram-shortcode.php

Powerkit [powerkit_subscription_form] Shortcode

The Powerkit Subscription Form shortcode is a dynamic tool that allows you to create a subscription form with customizable parameters. It includes options for privacy text, title, text, background image, list ID, type, and display name.

Shortcode: [powerkit_subscription_form]

Parameters

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

  • privacy – the text displayed on the privacy section of the form
  • title – the title that appears above the subscription form
  • text – the text that appears inside the subscription form
  • bg_image_id – the ID of the background image for the form
  • list_id – the ID of the Mailchimp list to subscribe users to
  • type – the layout style of the form, can be ‘block’ or ‘inline’
  • display_name – a boolean value that determines if the name field is displayed

Examples and Usage

Basic example – The shortcode below can be used to display a basic subscription form with default settings.

[powerkit_subscription_form /]

Advanced examples

Displaying a subscription form with a custom title and text. The ‘title’ parameter sets the title of the form, while the ‘text’ parameter allows you to add additional text to the form.

[powerkit_subscription_form title="Subscribe to our newsletter" text="Get our latest news and updates directly in your inbox." /]

Displaying a subscription form with a custom background image. The ‘bg_image_id’ parameter allows you to set a custom background image for the form by referencing the image’s ID in your media library.

[powerkit_subscription_form bg_image_id=123 /]

Displaying a subscription form that allows users to enter their name. The ‘display_name’ parameter can be set to ‘true’ to enable this feature.

[powerkit_subscription_form display_name=true /]

Displaying a subscription form for a specific Mailchimp list. The ‘list_id’ parameter allows you to specify the ID of the list that subscribers will be added to.

[powerkit_subscription_form list_id="abc123" /]

PHP Function Code

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

Shortcode line:

add_shortcode( 'powerkit_subscription_form', 'powerkit_subscription_shortcode' );

Shortcode PHP function:

function powerkit_subscription_shortcode( $atts, $content = '' ) {

	$params = powerkit_shortcode_atts( shortcode_atts( array(
		'privacy'     => powerkit_mailchimp_get_privacy_text(),
		'title'       => '',
		'text'        => '',
		'bg_image_id' => '',
		'list_id'     => 'default',
		'type'        => 'block',
		'display_name' => false,
	), $atts ) );

	ob_start();

	$tag = apply_filters( 'powerkit_subscription_title_tag', 'h3' );

	if ( $params['title'] ) {
		$params['title'] = sprintf( '<%1$s class="pk-title">%2$s</%1$s>', $tag, $params['title'] );
	}

	do_action( 'powerkit_subscribe_template', $params );

	return ob_get_clean();
}

Code file location:

powerkit/powerkit/modules/opt-in-forms/public/class-powerkit-subscription-form-shortcode.php

Powerkit [powerkit_pinterest_board] Shortcode

The Powerkit Pinterest Board shortcode allows you to embed a Pinterest board on your website. The shortcode uses the ‘href’ attribute to specify the URL of the Pinterest board. If the URL is not provided, a warning message is displayed. The board is displayed within a div element with a class of ‘pinterest-board-wrapper’, and it takes up 100% of the width of its container.

Shortcode: [powerkit_pinterest_board]

Parameters

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

  • href – Represents the URL of the Pinterest board to embed.

Examples and Usage

Basic example – A simple usage of the shortcode to display a Pinterest board. It requires the URL of the Pinterest board as a parameter.

[powerkit_pinterest_board href="https://www.pinterest.com/pinterest/official-news/"/]

Advanced examples

Using the shortcode without providing the Pinterest board URL. In this case, the shortcode will display a warning message stating that the “Pinterest Board URL” field is required.

[powerkit_pinterest_board /]

Using the shortcode with an invalid Pinterest board URL. The shortcode will attempt to display the board, but since the URL is invalid, the Pinterest widget will likely show an error message or a blank space.

[powerkit_pinterest_board href="https://www.pinterest.com/invalid-url/"/]

PHP Function Code

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

Shortcode line:

add_shortcode( 'powerkit_pinterest_board', 'powerkit_pinterest_board_shortcode' );

Shortcode PHP function:

function powerkit_pinterest_board_shortcode( $atts, $content = '' ) {

	$params = powerkit_shortcode_atts( shortcode_atts( array(
		'href' => '',
	), $atts ) );

	ob_start();

	if ( $params['href'] ) {
	?>
		<div class="pinterest-board-wrapper">
			<a data-pin-do="embedBoard" data-pin-board-width="100%" href="<?php echo esc_attr( $params['href'] ); ?>"></a>
		</div>
	<?php
	} else {
		powerkit_alert_warning( esc_html__( 'The "Pinterest Board URL" field is required!', 'powerkit' ) );
	}

	return ob_get_clean();
}

Code file location:

powerkit/powerkit/modules/pinterest/public/class-powerkit-pinterest-shortcode.php

Powerkit [powerkit_pinterest_profile] Shortcode

The Powerkit Pinterest Profile shortcode provides an easy way to embed a Pinterest profile on your site. This shortcode takes a ‘href’ parameter, which should be the URL of the Pinterest profile you want to display. If the URL is not provided, a warning message will be displayed. The Pinterest profile is wrapped in a div for easy styling.

Shortcode: [powerkit_pinterest_profile]

Parameters

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

  • href – The URL of the Pinterest profile to be embedded.

Examples and Usage

Basic example – Display a Pinterest profile using the profile URL

[powerkit_pinterest_profile href="https://www.pinterest.com/username/"]

Advanced examples

There aren’t any additional parameters available for this shortcode other than the ‘href’ parameter. However, you can use this shortcode in conjunction with other shortcodes or within a larger block of content to create more complex displays.

For example, you could use this shortcode within a custom HTML block to add additional styling or layout around the Pinterest profile display:


<div style="border: 1px solid #ccc; padding: 10px;">
    [powerkit_pinterest_profile href="https://www.pinterest.com/username/"]
</div>

Or, you could use this shortcode in conjunction with the ‘column’ shortcode to display multiple Pinterest profiles side by side:


[column]
    [powerkit_pinterest_profile href="https://www.pinterest.com/username1/"]
[/column]
[column]
    [powerkit_pinterest_profile href="https://www.pinterest.com/username2/"]
[/column]

PHP Function Code

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

Shortcode line:

add_shortcode( 'powerkit_pinterest_profile', 'powerkit_pinterest_profile_shortcode' );

Shortcode PHP function:

function powerkit_pinterest_profile_shortcode( $atts, $content = '' ) {

	$params = powerkit_shortcode_atts( shortcode_atts( array(
		'href' => '',
	), $atts ) );

	ob_start();

	if ( $params['href'] ) {
	?>
		<div class="pinterest-profile-wrapper">
			<a data-pin-do="embedUser" data-pin-board="100%" href="<?php echo esc_attr( $params['href'] ); ?>"></a>
		</div>
	<?php
	} else {
		powerkit_alert_warning( esc_html__( 'The "Pinterest Profile URL" field is required!', 'powerkit' ) );
	}

	return ob_get_clean();
}

Code file location:

powerkit/powerkit/modules/pinterest/public/class-powerkit-pinterest-shortcode.php

Powerkit [powerkit_share_buttons] Shortcode

The Powerkit Share Buttons shortcode enables dynamic social sharing buttons on your WordPress site. It offers customization options for accounts, icons, labels, and counts. This shortcode allows you to specify which social accounts to include, whether to display the total share count, the icons of the social platforms, labels, and individual share counts. The layout, scheme, and mode can also be customized. The PHP function associated with the shortcode processes these parameters, generates the social sharing buttons accordingly, and returns the HTML for these buttons.

Shortcode: [powerkit_share_buttons]

Parameters

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

  • accounts – Specifies the social media accounts for sharing.
  • total – If true, it displays the total share count.
  • icons – If true, it displays the social media icons.
  • labels – If true, it displays the social media platform names.
  • counts – If true, it displays the number of shares for each platform.
  • titles – If false, it hides the title for the share buttons.
  • title_location – Determines where the title is located (‘inside’ by default).
  • label_location – Determines where the label is located (‘inside’ by default).
  • count_location – Determines where the count is located (‘inside’ by default).
  • mode – Sets the mode of the share buttons (‘mixed’ by default).
  • layout – Sets the layout of the share buttons (‘default’ by default).
  • scheme – Sets the color scheme of the share buttons (‘default’ by default).

Examples and Usage

Basic example – The following shortcode will display the share buttons with default settings. It includes all available accounts, total share counts, icons, labels, and counts inside the buttons.

[powerkit_share_buttons /]

Advanced examples

Customizing the shortcode to display share buttons for specific accounts. In this example, we are specifying the accounts to ‘facebook’ and ‘twitter’ only.

[powerkit_share_buttons accounts="facebook,twitter" /]

Utilizing the shortcode to display share buttons with a different layout and scheme. Here, the layout is set to ‘block’ and the scheme to ‘dark’.

[powerkit_share_buttons layout="block" scheme="dark" /]

Modifying the shortcode to display share buttons without total share counts, icons, and labels. In this case, the ‘total’, ‘icons’, and ‘labels’ parameters are set to ‘false’.

[powerkit_share_buttons total="false" icons="false" labels="false" /]

Using the shortcode to display share buttons with title and label located outside. The ‘title_location’ and ‘label_location’ parameters are set to ‘outside’.

[powerkit_share_buttons title_location="outside" label_location="outside" /]

PHP Function Code

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

Shortcode line:

add_shortcode( 'powerkit_share_buttons', 'powerkit_share_buttons_shortcode' );

Shortcode PHP function:

function powerkit_share_buttons_shortcode( $atts, $content = '' ) {

	$params = powerkit_shortcode_atts( shortcode_atts( array(
		'accounts'       => '',
		'total'          => true,
		'icons'          => true,
		'labels'         => true,
		'counts'         => true,
		'titles'         => false,
		'title_location' => 'inside',
		'label_location' => 'inside',
		'count_location' => 'inside',
		'mode'           => 'mixed',
		'layout'         => 'default',
		'scheme'         => 'default',
	), $atts ) );

	$params['total']  = filter_var( $params['total'], FILTER_VALIDATE_BOOLEAN );
	$params['labels'] = filter_var( $params['labels'], FILTER_VALIDATE_BOOLEAN );
	$params['counts'] = filter_var( $params['counts'], FILTER_VALIDATE_BOOLEAN );

	ob_start();

	// Accounts.
	if ( $params['accounts'] ) {
		$params['accounts'] = explode( ',', $params['accounts'] );

		if ( $params['accounts'] ) {
			foreach ( $params['accounts'] as $key => $val ) {
				$params['accounts'][ $key ] = trim( $val );
			}
		}
	}

	// Get Shares.
	powerkit_share_buttons( $params['accounts'], $params['total'], $params['icons'], $params['titles'], $params['labels'], $params['counts'], $params['title_location'], $params['label_location'], $params['count_location'], $params['mode'], $params['layout'], $params['scheme'], '' );

	return ob_get_clean();
}

Code file location:

powerkit/powerkit/modules/share-buttons/public/class-powerkit-share-buttons-shortcode.php

Powerkit [powerkit_social_link] Shortcode

The Powerkit Social Link shortcode is designed to display social media follower counts. It accepts network name, cache, and mode parameters. If the network name is incorrect, it returns an error message.

Shortcode: [powerkit_social_link]

Parameters

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

  • network – specifies the social network for the link
  • cache – determines if the network link count is cached
  • mode – sets the counter mode for social links

Examples and Usage

Basic example – Display the social link count of a specific network.

[powerkit_social_link network="facebook" /]

Advanced example – Display the social link count of a specific network with control over caching and mode.

[powerkit_social_link network="twitter" cache="false" mode="mixed" /]

In this advanced example, the ‘network’ parameter is set to ‘twitter’. The ‘cache’ parameter is set to ‘false’ meaning the social link count will not be cached and will be fetched every time. The ‘mode’ parameter is set to ‘mixed’ which is the default mode for the ‘powerkit_social_links_counter_mode’ filter.

PHP Function Code

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

Shortcode line:

add_shortcode( 'powerkit_social_link', 'powerkit_social_link_shortcode' );

Shortcode PHP function:

function powerkit_social_link_shortcode( $atts, $content = '' ) {
	$params = powerkit_shortcode_atts( shortcode_atts( array(
		'network' => false,
		'cache'   => true,
		'mode'    => apply_filters( 'powerkit_social_links_counter_mode', 'mixed' ),
	), $atts ) );

	$params['cache'] = filter_var( $params['cache'], FILTER_VALIDATE_BOOLEAN );

	if ( $params['network'] ) {
		return powerkit_social_links_get_count( $params['network'], $params['cache'] );
	} else {
		return esc_html__( 'Network name is incorrect!', 'powerkit' );
	}
}

Code file location:

powerkit/powerkit/modules/social-links/public/class-powerkit-social-links-shortcode.php

Powerkit [powerkit_social_links] Shortcode

The Powerkit Social Links shortcode is a versatile tool for displaying social links. It supports various templates, schemes, and modes, and allows for customization of titles, labels, and counts. In this shortcode, you can control the visibility of labels, titles, and counts. It also includes a cache feature for improved performance.

Shortcode: [powerkit_social_links]

Parameters

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

  • title – Specifies the title of the Social Links section.
  • template – Defines the layout style of the Social Links.
  • scheme – Sets the color scheme, either ‘light’ or ‘dark’.
  • maximum – Limits the number of social links displayed.
  • cache – Controls whether to cache the social links or not.
  • labels – Determines if social media platform names are shown.
  • titles – Decides if the titles of social links are displayed.
  • counts – Regulates whether to show the number of followers or not.
  • mode – Sets the counter mode for the social links.

Examples and Usage

Basic example – Displaying social links with default parameters

[powerkit_social_links]

Advanced examples

Displaying social links with a dark scheme and without labels

[powerkit_social_links scheme="dark" labels="false"]

Displaying a maximum of 5 social links, with titles but without counts

[powerkit_social_links maximum="5" titles="true" counts="false"]

Displaying social links with a custom title, in inline template, and with caching disabled

[powerkit_social_links title="Follow Us" template="inline" cache="false"]

These examples show the versatility of the ‘powerkit_social_links’ shortcode, allowing you to customize the appearance and functionality of your social links to suit your website’s needs.

PHP Function Code

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

Shortcode line:

add_shortcode( 'powerkit_social_links', 'powerkit_social_links_shortcode' );

Shortcode PHP function:

function powerkit_social_links_shortcode( $atts, $content = '' ) {
	$params = powerkit_shortcode_atts( shortcode_atts( array(
		'title'    => esc_html__( 'Social Links', 'powerkit' ),
		'template' => 'inline',
		'scheme'   => 'light',
		'maximum'  => -1,
		'cache'    => true,
		'labels'   => true,
		'titles'   => true,
		'counts'   => true,
		'mode'     => apply_filters( 'powerkit_social_links_counter_mode', 'mixed' ),
	), $atts ) );

	ob_start();

	$params['cache']  = filter_var( $params['cache'], FILTER_VALIDATE_BOOLEAN );
	$params['labels'] = filter_var( $params['labels'], FILTER_VALIDATE_BOOLEAN );
	$params['titles'] = filter_var( $params['titles'], FILTER_VALIDATE_BOOLEAN );
	$params['counts'] = filter_var( $params['counts'], FILTER_VALIDATE_BOOLEAN );

	powerkit_social_links_appearance( $params );

	return ob_get_clean();
}

Code file location:

powerkit/powerkit/modules/social-links/public/class-powerkit-social-links-shortcode.php

Powerkit [powerkit_toc] Shortcode

The Powerkit Table of Contents shortcode generates a table of contents for your post based on the headers. It allows customization of title, depth, minimum count, minimum characters, button visibility, and default state.

Shortcode: [powerkit_toc]

Parameters

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

  • title – Sets the title of the table of content.
  • depth – Defines the number of heading levels to include.
  • min_count – Minimum number of headings to generate the table of content.
  • min_characters – Minimum number of characters in post to show the table of content.
  • btn_hide – If true, hides the button for collapsing and expanding the table of content.
  • default_state – Sets the initial state of the table of content as either ‘expanded’ or ‘collapsed’.

Examples and Usage

Basic example – A simple usage of the powerkit_toc shortcode with default parameters.

[powerkit_toc]

Advanced examples

Here, we are specifying the ‘title’ and ‘depth’ parameters. The ‘title’ parameter will change the title of the table of contents, and the ‘depth’ parameter will change the depth of the headers to be included in the table of contents.

[powerkit_toc title="Table of Contents" depth=3]

In this example, we are setting the ‘min_count’ and ‘min_characters’ parameters. The ‘min_count’ parameter will set the minimum number of headers required to display the table of contents, and the ‘min_characters’ parameter will set the minimum number of characters a post should have to display the table of contents.

[powerkit_toc min_count=5 min_characters=1500]

In the following example, we are setting the ‘btn_hide’ and ‘default_state’ parameters. The ‘btn_hide’ parameter will determine whether the hide button is displayed, and the ‘default_state’ parameter will set the default state of the table of contents.

[powerkit_toc btn_hide=true default_state="collapsed"]

PHP Function Code

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

Shortcode line:

add_shortcode( 'powerkit_toc', 'powerkit_toc_shortcode' );

Shortcode PHP function:

function powerkit_toc_shortcode( $atts, $content = '' ) {

	$params = powerkit_shortcode_atts( shortcode_atts( array(
		'title'          => '',
		'depth'          => 2,
		'min_count'      => 4,
		'min_characters' => 1000,
		'btn_hide'       => false,
		'default_state'  => 'expanded',
	), $atts ) );

	ob_start();

	powerkit_toc_list( $params );

	return ob_get_clean();
}

Code file location:

powerkit/powerkit/modules/table-of-contents/helpers/helper-powerkit-table-of-contents.php

Powerkit [powerkit_twitter_feed] Shortcode

The Powerkit Twitter Feed shortcode is used to display a Twitter feed on your WordPress site. It allows customization with parameters like ‘title’, ‘number’, ‘template’, ‘header’, and ‘button’. .

Shortcode: [powerkit_twitter_feed]

Parameters

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

  • title – Defines the title of the Twitter feed.
  • number – Sets the number of tweets to display.
  • template – Specifies the template used to style the Twitter feed.
  • header – Controls whether to display the header or not.
  • button – Decides if the button is displayed within the Twitter feed.

Examples and Usage

Basic example – A simple usage of the powerkit_twitter_feed shortcode to display the last 5 tweets from your Twitter feed.

[powerkit_twitter_feed number=5 /]

Advanced examples

Display a Twitter feed with a custom title, showing the last 3 tweets, using a custom template, and without the header and button.

[powerkit_twitter_feed title="My Custom Title" number=3 template="custom" header=false button=false /]

Display a Twitter feed with the default title, showing the last 10 tweets, using the default template, but without the header and with the button.

[powerkit_twitter_feed number=10 header=false button=true /]

These examples show how you can use the powerkit_twitter_feed shortcode to customize the display of your Twitter feed on your WordPress site. The shortcode is flexible and allows you to control various aspects of the feed display.

PHP Function Code

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

Shortcode line:

add_shortcode( 'powerkit_twitter_feed', 'powerkit_twitter_shortcode' );

Shortcode PHP function:

function powerkit_twitter_shortcode( $atts, $content = '' ) {
	$params = powerkit_shortcode_atts( shortcode_atts( array(
		'title'    => esc_html__( 'Twitter Feed', 'powerkit' ),
		'number'   => 5,
		'template' => 'default',
		'header'   => true,
		'button'   => true,
	), $atts ) );

	ob_start();

	powerkit_twitter_get_recent( $params );

	return ob_get_clean();
}

Code file location:

powerkit/powerkit/modules/twitter/public/class-powerkit-twitter-shortcode.php

Conclusion

Now that you’ve learned how to embed the Powerkit Plugin shortcodes, 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 *