Below, you’ll find a detailed guide on how to add the Fuse Social Floating Sidebar 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 Fuse Social Floating Sidebar Plugin shortcodes not to show or not to work correctly.
Before starting, here is an overview of the Fuse Social Floating Sidebar Plugin and the shortcodes it provides:
"Fuse Social Floating Sidebar is a dynamic WordPress plugin that adds a customizable, floating sidebar on your site for easy social media sharing. Enhance your site's interactivity today!"
- [bloginfo]
- [themeinfo]
- [date]
Fuse Social Floating Sidebar [bloginfo] Shortcode
The Fuse Social Floating Sidebar shortcode enables users to fetch various information about their blog. It uses the ‘bloginfo’ attribute to return data like stylesheet directory, template URLs, text direction, and more.
Shortcode: [bloginfo]
Parameters
Here is a list of all possible bloginfo shortcode parameters and attributes:
stylesheet_directory
– Gives the path of the active theme’s directory.child_template_directory
– Returns the path of the child theme’s directory.parent_template_url
– Provides URL of the parent theme’s directory.child_template_url
– Returns URL of the child theme’s directory.template_url
– Gives URL of the active theme’s directory.template_directory
– Provides the path of the parent theme’s directory.text_direction
– Indicates the text direction of the site.text_direction_bool
– Returns true if the text direction is right-to-left.text_direction_boolean
– Same as ‘text_direction_bool’, returns text direction.is_multisite
– Returns true if WordPress is set up for multiple sites.url
– Provides the home URL of the WordPress site.root_url
– Gives the site URL of the WordPress installation.stylesheet_url
– Returns URL of the active theme’s stylesheet.logout_url
– Provides the logout URL for the WordPress site.login_url
– Returns the login URL of the WordPress site.register_url
– Gives the registration URL of the WordPress site.lostpassword_url
– Provides the lost password URL of the site.lost_password_url
– Same as ‘lostpassword_url’, returns lost password URL.
Examples and Usage
Basic example – A simple usage of the shortcode to retrieve the URL of the current WordPress site.
[bloginfo data="url" /]
Advanced examples
Here we use the shortcode to retrieve the URL of the stylesheet directory. This can be useful when you need to reference the directory in your theme or plugin.
[bloginfo data="stylesheet_directory" /]
Another advanced usage of the shortcode can be to check if the site is part of a multisite network. This will return a boolean value, true if the site is part of a multisite network, and false if it isn’t.
[bloginfo data="is_multisite" /]
Lastly, the shortcode can be used to retrieve the URL for the user registration page. This can be handy when creating custom login or registration forms.
[bloginfo data="register_url" /]
PHP Function Code
In case you have difficulties debugging what causing issues with [bloginfo]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'bloginfo', array( $this, 'blog_info' ) );
Shortcode PHP function:
function blog_info( $atts = array(), string $content = null ) {
if ( ! is_array( $atts ) ) {
$atts = array();
}
if ( ! empty( $content ) && ! isset( $atts['data'] ) ) {
$atts['data'] = $content;
}
switch ( $atts['data'] ) {
case 'stylesheet_directory':
case 'child_template_directory':
return get_stylesheet_directory();
case 'parent_template_url':
return get_template_directory_uri();
case 'child_template_url':
case 'template_url':
return get_stylesheet_directory_uri();
case 'template_directory':
return get_template_directory();
case 'text_direction':
case 'text_direction_bool':
case 'text_direction_boolean':
return is_rtl();
case 'is_multisite':
return is_multisite();
case 'url':
return esc_url( home_url() );
case 'root_url':
return esc_url( site_url() );
case 'stylesheet_url':
return esc_url( get_stylesheet_uri() );
case 'logout_url':
return esc_url( wp_logout_url() );
case 'login_url':
return esc_url( wp_login_url() );
case 'register_url':
return esc_url( wp_registration_url() );
case 'lostpassword_url':
case 'lost_password_url':
return esc_url( wp_lostpassword_url() );
default:
return get_bloginfo( $atts['data'] );
}
}
Code file location:
fuse-social-floating-sidebar/fuse-social-floating-sidebar/framework/redux-core/inc/extensions/shortcodes/class-redux-shortcodes.php
Fuse Social Floating Sidebar [themeinfo] Shortcode
The fuse-social-floating-sidebar plugin shortcode, ‘themeinfo’, retrieves and displays various theme information. It checks if the theme is a child theme and returns theme details like name, author, version, etc.
Shortcode: [themeinfo]
Parameters
Here is a list of all possible themeinfo shortcode parameters and attributes:
name
– Displays the name of the theme.themeuri
ortheme_uri
– Shows the theme’s URI.description
– Shows the theme’s description.author
– Shows the name of the theme’s author.authoruri
orauthor_uri
– Displays the URI of the author.version
– Shows the current theme’s version.template
– Displays the template of the theme.status
– Shows the status of the theme.tags
– Shows the tags related to the theme.textdomain
ortext_domain
– Displays the text domain of the theme.domainpath
ordomain_path
– Shows the domain path of the theme.is_child
– Indicates if the theme is a child theme.
Examples and Usage
Basic example – Retrieves the theme name using the shortcode ‘themeinfo’ and the ‘name’ attribute.
[themeinfo data="name" /]
Advanced examples
Fetches the theme description using the shortcode ‘themeinfo’ and the ‘description’ attribute. If the theme description is not available, it will return an empty string.
[themeinfo data="description" /]
Displays the theme’s author name using the shortcode ‘themeinfo’ and the ‘author’ attribute. If the author information is not set, it will return an empty string.
[themeinfo data="author" /]
Shows whether the theme is a child theme or not using the shortcode ‘themeinfo’ and the ‘is_child’ attribute. It will return true if the theme is a child theme and false if it is not.
[themeinfo data="is_child" /]
Retrieves the theme version using the shortcode ‘themeinfo’ and the ‘version’ attribute. If the version information is not available, it will return an empty string.
[themeinfo data="version" /]
PHP Function Code
In case you have difficulties debugging what causing issues with [themeinfo]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'themeinfo', array( $this, 'theme_info' ) );
Shortcode PHP function:
function theme_info( array $atts = array(), string $content = null ) {
if ( ! is_array( $atts ) ) {
$atts = array();
}
if ( ! empty( $content ) && ! isset( $atts['data'] ) ) {
$atts['data'] = $content;
}
if ( empty( $this->theme_info ) ) {
$this->theme_info = wp_get_theme();
}
$keys = array(
'name' => 'Name',
'themeuri' => 'ThemeURI',
'theme_uri' => 'ThemeURI',
'description' => 'Description',
'author' => 'Author',
'authoruri' => 'AuthorURI',
'author_uri' => 'AuthorURI',
'version' => 'Version',
'template' => 'Template',
'status' => 'Status',
'tags' => 'Tags',
'textdomain' => 'TextDomain',
'text_domain' => 'TextDomain',
'domainpath' => 'DomainPath',
'domain_path' => 'DomainPath',
'is_child' => 'is_child',
);
$atts['data'] = $keys[ strtolower( $atts['data'] ) ];
switch ( $atts['data'] ) {
case 'is_child':
return Redux_Helpers::is_child_theme( get_template_directory() );
default:
$return = $this->theme_info->get( $atts['data'] );
if ( is_array( $return ) ) {
$return = implode( ', ', $return );
}
return $return;
}
}
Code file location:
fuse-social-floating-sidebar/fuse-social-floating-sidebar/framework/redux-core/inc/extensions/shortcodes/class-redux-shortcodes.php
Fuse Social Floating Sidebar [date] Shortcode
The Fuse Social Floating Sidebar plugin’s ‘date’ shortcode displays the current date. The format can be customized using the ‘data’ attribute. The code checks if the ‘data’ attribute is set, if not, it defaults to the ‘Y’ format, representing the full numeric year. If a content is passed, it’s used as the ‘data’ attribute. Shortcode: [date data=”Y-m-d”] This will display the date in ‘Year-Month-Day’ format. The shortcode uses the gmdate() function, which returns the current date/time in Greenwich Mean Time (GMT).
Shortcode: [date]
Parameters
Here is a list of all possible date shortcode parameters and attributes:
data
– sets the date format based on PHP date() function.
Examples and Usage
Basic example – A simple usage of the date shortcode that will return the current year in ‘Y’ format.
[date /]
Advanced examples
Using the date shortcode to display the current date in ‘d-m-Y’ format. This will return the date in the format of day-month-year.
[date data="d-m-Y" /]
Another advanced usage of the date shortcode can be to display the current time in ‘H:i:s’ format. This will return the current time in the format of hours:minutes:seconds.
[date data="H:i:s" /]
In these advanced examples, the ‘data’ attribute is used to specify the format in which the date or time should be displayed. The ‘Y’ format returns the current year, ‘d-m-Y’ returns the current date, and ‘H:i:s’ returns the current time. This shortcode is useful for displaying dynamic date or time information on your WordPress site.
PHP Function Code
In case you have difficulties debugging what causing issues with [date]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'date', array( $this, 'date' ) );
Shortcode PHP function:
function date( $atts = array(), string $content = null ) {
if ( ! is_array( $atts ) ) {
$atts = array();
}
if ( ! empty( $content ) && ! isset( $atts['data'] ) ) {
$atts['data'] = $content;
}
if ( empty( $atts['data'] ) ) {
$atts['data'] = 'Y';
}
return gmdate( $atts['data'] );
}
Code file location:
fuse-social-floating-sidebar/fuse-social-floating-sidebar/framework/redux-core/inc/extensions/shortcodes/class-redux-shortcodes.php
Conclusion
Now that you’ve learned how to embed the Fuse Social Floating Sidebar 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.
Leave a Reply