Below, you’ll find a detailed guide on how to add the Float menu – awesome floating side menu Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Float menu – awesome floating side menu Plugin shortcode not to show or not to work correctly.
Before starting, here is an overview of the Float menu – awesome floating side menu Plugin and the shortcodes it provides:
"Float Menu is an innovative WordPress plugin that adds an attractive floating side menu to your site. It enhances navigation, user experience and site aesthetics."
- [float_menu]
Float menu [float_menu] Shortcode
The Float-Menu plugin shortcode is used to create a customizable floating menu on your website. This shortcode extracts the ‘id’ from the attributes, fetches the corresponding data from the database, and checks its validity. If the data is valid, it includes the ‘public.php’ file, generates the menu, includes necessary style and script files, and finally returns the menu.
Shortcode: [float_menu]
Parameters
Here is a list of all possible float_menu shortcode parameters and attributes:
id
– The unique identifier for the specific float-menu
Examples and Usage
Basic example – Display a specific float-menu on your website by referencing its ID
[float-menu id=1 /]
Advanced examples
Display multiple float-menus on your website by referencing their IDs. The float-menus will load in the order they are listed.
[float-menu id=1,2,3 /]
Display a specific float-menu and set custom parameters. In this example, the float-menu with ID 1 will load with a custom color and font size.
[float-menu id=1 color="red" font-size="14px" /]
Display a float-menu by referencing its title. If a menu with the specified title is not found, the shortcode will return false.
[float-menu title="My Menu" /]
PHP Function Code
In case you have difficulties debugging what causing issues with [float_menu]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( $this->plugin['shortcode'], array( $this, 'shortcode' ) );
Shortcode PHP function:
function shortcode( $atts ) {
extract( shortcode_atts( array( 'id' => "" ), $atts ) );
$id = absint( $atts['id'] );
global $wpdb;
$table = $wpdb->prefix . 'wow_' . $this->plugin['prefix'];
$sSQL = $wpdb->prepare( "select * from $table WHERE id = %d", $id );
$result = $wpdb->get_results( $sSQL, 'OBJECT_K' );
if ( empty( $result ) ) {
return false;
}
$param = unserialize( $result[ $id ]->param );
$check = $this->check( $param, $id );
if ( $check === false ) {
return false;
}
ob_start();
include( 'partials/public.php' );
$menu = ob_get_contents();
ob_end_clean();
$this->include_style_script( $param, $id );
return $menu;
}
Code file location:
float-menu/float-menu/public/class-public.php
Conclusion
Now that you’ve learned how to embed the Float menu – awesome floating side menu Plugin shortcode, 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