Staff List Shortcodes

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

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

Plugin Icon
Staff List

"Staff List is a highly efficient WordPress plugin that allows you to create, manage, and display a list of your team members on your website easily."

★★★★✩ (22) Active Installs: 4000+ Tested with: 6.4 PHP Version: 5.6
Included Shortcodes:
  • [abcf-staff-list]
  • [abcf-staff-single]
  • [abcf-staff-list-i]

Staff List [abcf-staff-list] Shortcode

The ABCF Staff List shortcode is a custom function that adds a staff list to your WordPress site. This shortcode calls the ‘abcfsl_scode_add_list’ function, which returns a staff list created by ‘abcfsl_cnt_list’ function. It accepts shortcode arguments (‘scodeArgs’) to customize the list.

Shortcode: [abcf-staff-list]

Examples and Usage

Basic example – A simple usage of the ‘abcf-staff-list’ shortcode to add a staff list to your page.

[abcf-staff-list /]

Advanced examples

Adding a staff list with specific parameters. Here, we are passing an ‘id’ parameter to specify which staff list we want to display.

[abcf-staff-list id=2 /]

Adding a staff list with multiple parameters. In this example, we are not only specifying the ‘id’ of the staff list, but also a ‘style’ parameter to define how the list should be displayed.

[abcf-staff-list id=3 style='grid' /]

Adding a staff list with even more parameters. Here, we specify the ‘id’, ‘style’, and ‘order’ parameters to display a specific staff list, in a specific style, and in a specific order.

[abcf-staff-list id=4 style='list' order='desc' /]

PHP Function Code

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

Shortcode line:

add_shortcode( 'abcf-staff-list', 'abcfsl_scode_add_list' );

Shortcode PHP function:

function abcfsl_scode_add_list( $scodeArgs ) {
    return abcfsl_cnt_list( abcfsl_scode_args( $scodeArgs ) );
}

Code file location:

staff-list/staff-list/inc/shortcode.php

Staff List [abcf-staff-single] Shortcode

The ‘abcf-staff-single’ shortcode is used to display specific staff member details on a page. It fetches data based on the ‘smid’ query variable, which represents the staff member ID.

Shortcode: [abcf-staff-single]

Parameters

Here is a list of all possible abcf-staff-single shortcode parameters and attributes:

  • scodeArgs – Array of arguments passed to the shortcode
  • smid – The unique identifier of the staff member
  • staff-name – The name of the staff member

Examples and Usage

Basic example – Display a single staff member using their ID

[abcf-staff-single smid=1 /]

Advanced examples

Display a single staff member using their ID and name. The plugin will first try to load the staff member by ID, but if not found, it will try to load by name.

[abcf-staff-single smid=1 staff-name="John Doe" /]

In case you want to override the default settings of the plugin, you can specify additional parameters. In the example below, we are displaying a staff member with ID 1, overriding the default layout and style settings.

[abcf-staff-single smid=1 layout="grid" style="modern" /]

It’s also possible to use the shortcode without specifying any parameters. In this case, the plugin will load the staff member based on the query parameters in the URL.

[abcf-staff-single /]

PHP Function Code

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

Shortcode line:

add_shortcode( 'abcf-staff-single', 'abcfsl_scode_add_single' );;

Shortcode PHP function:

function abcfsl_scode_add_single( $scodeArgs ) {

    $args = shortcode_atts( abcfsl_scode_defaults(), $scodeArgs );
    $staffMemberID = ( get_query_var('smid') ) ? get_query_var('smid' ) : 0;
    $args['smid'] =  $staffMemberID;
    $args['staff-name'] = get_query_var('staff-name');

    return abcfsl_cnt_spage($args);
}

Code file location:

staff-list/staff-list/inc/shortcode.php

Staff List [abcf-staff-list-i] Shortcode

The ‘abcf-staff-list-i’ shortcode is a function that displays a staff list on your WordPress site. It accepts a set of arguments, then checks if ‘menu-id’ is empty. If not, it enqueues necessary scripts and outputs the staff list in HTML format.

Shortcode: [abcf-staff-list-i]

Parameters

Here is a list of all possible abcf-staff-list-i shortcode parameters and attributes:

  • scodeArgs – Array of arguments passed to the function
  • tplate – Template identifier, ‘LI’ for list type
  • ajax – If ‘0’, AJAX is not used; otherwise, AJAX is used
  • menu-id – Identifier of the menu, if empty default HTML is returned
  • abcfsl_isotope – Enables isotope script for layout arrangement
  • images-loaded – If greater than ‘0’, image loading script is used
  • abcfsl_imagesloaded – Enables imagesLoaded script for handling image loading events
  • output – Holds the final HTML output of the function

Examples and Usage

Basic example – A simple usage of the staff-list plugin shortcode, where we don’t provide any specific parameters. The shortcode will use the default template and won’t use AJAX.

[abcf-staff-list-i /]

Advanced examples

Using the shortcode with a specific menu ID. In this case, the shortcode will use the template associated with the given menu ID. If the menu ID is not found or invalid, the shortcode will use the default template.

[abcf-staff-list-i menu-id=3 /]

Using the shortcode with AJAX enabled. This can be useful in situations where you want to load the staff list dynamically without reloading the page. The ‘ajax’ parameter can be set to either ‘1’ (enabled) or ‘0’ (disabled).

[abcf-staff-list-i ajax=1 /]

Using the shortcode with a specific template and AJAX enabled. This allows you to customize the appearance of the staff list and load it dynamically.

[abcf-staff-list-i tplate='LI' ajax=1 /]

Using the shortcode with the ‘images-loaded’ parameter set to ‘1’. This means that the staff list will be displayed only after all images have been loaded. This can be useful in situations where you have large images that might take some time to load.

[abcf-staff-list-i images-loaded=1 /]

PHP Function Code

In case you have difficulties debugging what causing issues with [abcf-staff-list-i] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'abcf-staff-list-i', 'abcfsl_scode_add_list_i' );

Shortcode PHP function:

function abcfsl_scode_add_list_i( $scodeArgs ) {
    $args = abcfsl_scode_args( $scodeArgs );
    $args['tplate']= 'LI';
    $args['ajax']= '0';

    if( empty( $args['menu-id'] )) {
        return abcfsl_cnt_html( $args );
    }

    wp_enqueue_script( 'abcfsl_isotope' );
    if( $args['images-loaded'] > 0 ) { wp_enqueue_script( 'abcfsl_imagesloaded' ); }

    ob_start();
    $output = abcfsl_cnt_html( $args );
    ob_end_clean(); 
    return  $output;
}

Code file location:

staff-list/staff-list/incf/shortcode.php

Conclusion

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