There are some available API of Shortcode Ultimate Joomla are show in below:
To add new file in head tag you can use addFile() function.
<?php suAsset::addFile('css', 'heading.css', __FUNCTION__); suAsset::addFile('js', 'heading.js', __FUNCTION__); ?>
Param Name | Type | Description |
---|---|---|
css/js | string | You can put here only css or js. "css" for adding any css file and "js" for adding javascript file in head tag |
filename.css or filename.js | string | Name of the file that you want to add. |
__FUNCTION__ | string | This param use for file location, for example: file will be loaded from /templates/your default template /html/plg_bdthemes_shortcodes/shortcodes/new_heading/css or js folder. If you not include this param so function search file in plugin css/js folder("\plugins\system\bdthemes_shortcodes\css or js") |
To add string of css or js in head tag, you can use addString() function.
<?php suAsset::addString('css', '.su-heading { font-size: 10px;}'); suAsset::addString('js', 'jQuery(document).ready(function ($) {});'); ?>
Param Name | Type | Description |
---|---|---|
css/js | string | You can put here only css or js. "css" for adding any css string and "js" for adding javascript string in head tag. |
string | string | put you custom css or js code. |
To add alert you can use alert_box() function.
<?php alert_box("alert message", 'warning'); ?>
Param Name | Type | Description |
---|---|---|
message | string | You can put any message here |
type | string | here available values are info/warning/danger |
To get options of shortcode that is showing in window of shortcode and to define shortcode name, desc, icon, type, you can use this get_config() function.
<?php static function get_config() { return array( 'name' => 'New Heading', 'type' => 'wrap', 'group' => 'content', 'content' => 'Your heading text here', 'desc' => "This is new Custom Heading Shortcode.", 'icon' => 'h-square', 'atts' => array( 'size' => array( 'type' => 'slider', 'min' => 7, 'max' => 48, 'step' => 1, 'default' => 16, 'name' => 'Size', 'desc' => 'Select Your Font Size from here' ), 'class' => array( 'default' => '', 'name' => 'Class', 'desc' => 'If you want to add extra CSS class for this element so type here' ) ) ); } ?>
Param Name | Description |
---|---|
name | Name is the title of this shortcode |
type | There are two type 1. wrap and 2. single. if have there any content of this shortcode, you must put "wrap" example: [new_heading]your content here[/new_heading]. Otherwise if there is no need any content you need to write "single". Example: [icon icon="icon: home"]. here "icon" has no content for this reason it's type is single. |
group | What kind of shortcode is it, we define by using this group. Actually it work as filtering. when we click "Insert Shortcode" button. All shortcodes are showing there with some filter button like content, box, media, gallery, other etc. So we can use content/box/media/gallery for it. |
content | Here you can set default content of this shortcode. |
icon | When you will go shortcode window, we see shortcodes with icon. you can set any icon of Font Awesome. |
atts | Here is explained all Attributes(i mean options) of this shortcode. Example: size, class etc. you will see these option when you click "insert Shortcode" > "New Heading". you can put here size of this heading and class. You will get all available atts in https://bdthemes.com/support/knowledge-base/available-options-type-of-shortcode-ultimate/ |
Available Attribute Type(I mean that Return Array => atts => size => type) There are some type that you can use like- slider(for set number that will set by dragging),color(for color selection),icon(for icon selection),select(for certain value select), border(for border assignment),shadow(for shadow), bool(for switch button). Note: if you do not want to use any type(like class attribute). you will get a text box where you can add anything.
To get all article as array you can use get_slides() function.
<?php $args = array( 'source' => 'none', 'limit' => 20, 'gallery' => null, 'type' => '', 'order' => '', 'order_by' => 'desc', 'link' => 'attachment' ); $slides = (array) Su_Tools::get_slides($atts); foreach ((array) $slides as $slide) { $image_url = $slide['image']; $title = $slide['title']; $intro_text = $slide['introtext']; $category = $slide['category']; $link = $slide['link']; $created = $slide['created']; } ?>
Param Name | Type | Description |
---|---|---|
$atts | array | For retrieving all date, you must set source and other available settings are blolow: |
Attribute | Description |
---|---|
Source | Source is the important. Here is explained that where from date will be retrieved |
Limit | Limit of articles will be loaded. |
gallery | |
type | type can be 'media', 'posts', 'category', 'k2-category' |
order | order can be title/created/ordering/hits |
order_by | order_by can be asc/desc |
link | link can be attachment/image |
Param Name | Description |
---|---|
$image_url | you can get URL of image of each article |
$title | get title of each article |
$intro_text | Get content text of each article. |
$category | Get category name of each article. |
$link | To get link use it. |
$created | Get article created date of each article |
To fix problem of image locate you can use image_media() function.
<?php image_media($image_url); ?>
Param Name | Type | Description |
---|---|---|
$image_url | string |
To returns the number of character in a string, You can use su_char_limit() function.
<?php su_char_limit($str, $limit, $end_char); ?>
Param Name | Type | Description |
---|---|---|
$str | string | any content string that you want to limit by number($limit) |
$limit | number | number of character of string. |
$end_char | string | A text that will show after limit of text |
To returns the number of words in a string, You can use su_word_limit() function.
<?php su_word_limit($str, $limit, $end_char); ?>
Param Name | Type | Description |
---|---|---|
$str | string | any content string that you want to limit by number($limit) |
$limit | number | number of word of string. |
$end_char | string | A text that will show after limit of text |
To compile shortcode of contents you can use su_do_shortcode() function.
Suppose, your content can be (a paragraph [spacer size="10"] a paragraph after spacer shortcode.). So you must need to compile this spacer shortcode. so that you can use this shortcode.
<?php su_do_shortcode($content); ?>
Param Name | Type | Description |
---|---|---|
$content | string | You can put here string that can be needed a compile. |
To convert or re-size you can use su_image_resize() function.
<?php $converted_image_url = su_image_resize( $image_location , $image_width , $image_height, $quality ); ?>
Param Name | Type | Description |
---|---|---|
$image_location | URL | You can put here the location of image source |
$image_width | Number | Put width as pixel of image |
$image_height | Number | Put Height as pixel of image |
$quality | Number | define image quality here. |
<?php $atts = su_shortcode_atts(array( 'size' => 16, 'class' => '' ), $atts, 'new_heading'); ?>
Param Name | Type | Description |
---|---|---|
$attribute | array | all available option can be added by using this array. Note: Array key is the name of option and Array-value is the default value of your shortcode. |
$shortcode | string | you must put here the name of shortcode. |
To create scroll animations of contents, you may use the function.
<?php $atts = su_shortcode_atts(array( 'scroll_reveal' => 'wait 0.4s, scale up 25%', 'class' => '' ), $atts, 'new_heading'); return '<h3' . su_scroll_reveal($atts) . '>'. su_do_shortcode($content) . '</h3>'; ?>
Param Name | Type | Description |
---|---|---|
$atts | array | the array must should contain a key which is "scroll_reveal" the available value of the key may be: enter top, enter left, enter right, enter bottom, over 0.6s, flip 45deg, spin 180deg, roll 15deg, scale up 20%, scale down 20%, scale 20%, wait 0.5s, reset, no reset, vFactor 0.1, vFactor 0.8, opacity 0.5, ease 50px, ease-in 50px, ease-out 50px, ease-in-out 50px, ease down 20%, hustle 30%, scale up 30% reset, roll 15deg wait 0.5s reset, enter top over 0.6s etc. For More Help: https://github.com/jlmakes/scrollReveal.js/wiki/Keywords |