Loading..

Shortcode Ultimate API Overview 0 1

Last updated on 28-Mar-2019 06:58:20 AM in Joomla » Plugins » Shortcode Ultimate
Posted ByTauhidul Alam


There are some available API of Shortcode Ultimate Joomla are show in below:


addFile()


To add new file in head tag you can use addFile() function.


Example


<?php 
suAsset::addFile('css', 'heading.css', __FUNCTION__);
suAsset::addFile('js', 'heading.js', __FUNCTION__); 
?>


Params


Param NameTypeDescription
css/jsstringYou 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.jsstringName of the file that you want to add.
__FUNCTION__stringThis 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")


 


 


addString()


To add string of css or js in head tag, you can use addString() function.


Example


<?php 
suAsset::addString('css',  '.su-heading { font-size: 10px;}');
suAsset::addString('js',  'jQuery(document).ready(function ($) {});'); 
?>


Params


Param NameTypeDescription
css/jsstringYou can put here only css or js. "css" for adding any css string and "js" for adding javascript string in head tag.
stringstringput you custom css or js code.


 


 


alert_box()


To add alert you can use alert_box() function.


Example


<?php 
alert_box("alert message", 'warning'); 
?>


Params


Param NameTypeDescription
messagestringYou can put any message here
typestringhere available values are info/warning/danger


 


 


get_config()


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.


Example


<?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'
                )
            )
        );
    }
?>


Params


Param NameDescription
nameName is the title of this shortcode
typeThere 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.
groupWhat 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.
contentHere you can set default content of this shortcode.
iconWhen you will go shortcode window, we see shortcodes with icon. you can set any icon of Font Awesome.
attsHere 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.


get_slides()


To get all article as array you can use get_slides() function.


Example


<?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'];
}
?>


Params


Param NameTypeDescription
$attsarrayFor retrieving all date, you must set source and other available settings are blolow:


Input Attributes


AttributeDescription
SourceSource is the important. Here is explained that where from date will be retrieved
LimitLimit of articles will be loaded.
gallery 
typetype can be 'media', 'posts', 'category', 'k2-category'
orderorder can be title/created/ordering/hits
order_byorder_by can be asc/desc
linklink can be attachment/image


Get Output Attributes


Param NameDescription
$image_urlyou can get URL of image of each article
$titleget title of each article
$intro_textGet content text of each article.
$categoryGet category name of each article.
$linkTo get link use it.
$createdGet article created date of each article


 


 


 


image_media()


To fix problem of image locate you can use image_media() function.


Example


<?php 
image_media($image_url);
?>


Params


Param NameTypeDescription
$image_urlstring 


 


 


su_char_limit()


To returns the number of character in a string, You can use su_char_limit() function.


Example


<?php 
su_char_limit($str, $limit, $end_char);
?>


Params


Param NameTypeDescription
$strstringany content string that you want to limit by number($limit)
$limitnumbernumber of character of string.
$end_charstringA text that will show after limit of text


 


 


su_word_limit()


To returns the number of words in a string, You can use su_word_limit() function.


Example


<?php 
su_word_limit($str, $limit, $end_char);
?>


Params


Param NameTypeDescription
$strstringany content string that you want to limit by number($limit)
$limitnumbernumber of word of string.
$end_charstringA text that will show after limit of text


 


 


su_do_shortcode()


To compile shortcode of contents you can use su_do_shortcode() function.


Why need this shortcode:


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.


Example


<?php 
su_do_shortcode($content);
?>


Params


Param NameTypeDescription
$contentstringYou can put here string that can be needed a compile.


 


 


su_image_resize()


To convert or re-size you can use su_image_resize() function.


Example


<?php
$converted_image_url = su_image_resize( $image_location , $image_width , $image_height, $quality );
?>


Params


Param NameTypeDescription
$image_locationURLYou can put here the location of image source
$image_widthNumberPut width as pixel of image
$image_heightNumberPut Height as pixel of image
$qualityNumberdefine image quality here.


 


 


 


Example


<?php 
$atts = su_shortcode_atts(array(
          'size'    => 16,
          'class'   => ''
       ), $atts, 'new_heading');
?>


Params


Param NameTypeDescription
$attributearrayall 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.
$shortcodestringyou must put here the name of shortcode.


 


 


su_scroll_reveal()


To create  scroll animations of contents, you  may use the function.


Example


<?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>';
?>


 


Params


Param NameTypeDescription
$attsarraythe 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


** The time is base on America/New_York timezone