Below, you’ll find a detailed guide on how to add the SeedProd 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 SeedProd Plugin shortcodes not to show or not to work correctly.
Before starting, here is an overview of the SeedProd Plugin and the shortcodes it provides:
"Website Builder by SeedProd is a multifaceted WordPress plugin. It serves as a theme builder, landing page creator, and also allows you to design 'Coming Soon' or 'Maintenance Mode' pages."
- [seedprodnestedmenuwidget]
- [seedprodwpwidget]
SeedProd [seedprodnestedmenuwidget] Shortcode
The SeedProd Nested Menu Widget shortcode creates a customizable menu in WordPress. It takes three parameters: ‘menu’, ‘menudivider’, and ‘layout’. ‘menu’ specifies the menu name, ‘menudivider’ sets the separator between menu items, and ‘layout’ defines the orientation (‘h’ for horizontal, ‘v’ for vertical). Depending on the ‘layout’ and ‘menudivider’, a custom walker class is used for the menu. The output is a clean, organized navigation menu.
Shortcode: [seedprodnestedmenuwidget]
Parameters
Here is a list of all possible seedprodnestedmenuwidget shortcode parameters and attributes:
menu
– Name of the menu to be displayedmenudivider
– Character used as a separator in the menulayout
– Layout style of the menu (‘h’ for horizontal, ‘v’ for vertical)
Examples and Usage
Basic example – Display a menu by referencing its name
[seedprodnestedmenuwidget menu="Main Menu" /]
Advanced examples
Display a menu with a specific divider and a horizontal layout. The divider will be used to separate each menu item, and the layout parameter will determine how the menu is displayed.
[seedprodnestedmenuwidget menu="Main Menu" menudivider="|" layout="h" /]
Display a menu with a specific divider and a vertical layout. In this case, the divider will not be used because the layout is vertical.
[seedprodnestedmenuwidget menu="Secondary Menu" menudivider="|" layout="v" /]
Display a menu without a divider. The menu items will be displayed next to each other without any separation.
[seedprodnestedmenuwidget menu="Footer Menu" /]
PHP Function Code
In case you have difficulties debugging what causing issues with [seedprodnestedmenuwidget]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'seedprodnestedmenuwidget', 'seedprod_lite_wordpress_menuwidget' );
Shortcode PHP function:
function seedprod_lite_wordpress_menuwidget( $atts ) {
$menu_atts = shortcode_atts(
array(
'menu' => '',
'menudivider' => '',
'layout' => 'h',
),
$atts
);
$navmenu_name = '';
if ( isset( $menu_atts['menu'] ) ) {
$navmenu_name = $menu_atts['menu'];
}
$navmenu_seperator = '';
if ( isset( $menu_atts['menudivider'] ) ) {
$navmenu_seperator = $menu_atts['menudivider'];
}
$layout = '';
if ( isset( $menu_atts['layout'] ) ) {
$layout = $menu_atts['layout'];
}
$walker_divider = true;
if ( '' == $navmenu_seperator || 'v' == $layout ) {
$walker_divider = false;
}
if ( true == $walker_divider ) {
$args = array(
'menu' => $navmenu_name,
'container_class' => 'nav-menu-bar',
'menu_class' => 'seedprod-menu-list',
'walker' => new SeedProd_Lite_Menu_Walker( $navmenu_seperator ),
);
} else {
$args = array(
'menu' => $navmenu_name,
'container_class' => 'nav-menu-bar',
'menu_class' => 'seedprod-menu-list',
);
}
ob_start();
wp_nav_menu( $args );
$content = ob_get_contents();
ob_end_clean();
return $content;
}
Code file location:
coming-soon/coming-soon/app/nestednavmenu.php
SeedProd [seedprodwpwidget] Shortcode
The SeedProd WordPress Widget shortcode allows you to add specific widgets to your posts or pages. Shortcode Name: SeedProd WordPress Widget. This shortcode retrieves the widget name from the attributes, converts string booleans to actual booleans, and outputs the widget content. It provides flexibility by letting you place widgets anywhere within your content.
Shortcode: [seedprodwpwidget]
Examples and Usage
Basic Example – A simple usage of the ‘seedprodwpwidget’ shortcode to display a specific widget by its name. In this case, we are displaying the ‘Calendar’ widget.
[seedprodwpwidget "WP_Widget_Calendar" /]
Advanced Examples
Here, we are using the ‘seedprodwpwidget’ shortcode to display the ‘Recent Posts’ widget with several parameters. We are setting the ‘number’ parameter to 5, which will display the five most recent posts. We are also setting the ‘show_date’ parameter to ‘true’, which will display the date of each post.
[seedprodwpwidget "WP_Widget_Recent_Posts" number="5" show_date="true" /]
Another advanced usage of the ‘seedprodwpwidget’ shortcode is to display the ‘Categories’ widget with the ‘dropdown’ parameter set to ‘true’. This will display the categories as a dropdown list instead of a list.
[seedprodwpwidget "WP_Widget_Categories" dropdown="true" /]
These examples demonstrate how to use the ‘seedprodwpwidget’ shortcode to display various WordPress widgets with different parameters. The shortcode is very flexible and can be used to display any widget that is registered with WordPress.
PHP Function Code
In case you have difficulties debugging what causing issues with [seedprodwpwidget]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'seedprodwpwidget', 'seedprod_lite_wordpress_widget' );
Shortcode PHP function:
function seedprod_lite_wordpress_widget( $atts ) {
$widget_name = $atts[0];
unset( $atts[0] );
// convert string bool
foreach ( $atts as $k => $v ) {
if ( 'true' === $v ) {
$atts[ $k ] = true; }
if ( 'false' === $v ) {
$atts[ $k ] = false; }
//$atts[$k] = ($v === 'true')? true: false;
}
global $wp_widget_factory;
$inst = $wp_widget_factory->widgets[ $widget_name ];
$instance = $atts;
ob_start();
the_widget( $widget_name, $instance );
$content = ob_get_contents();
ob_end_clean();
return $content;
}
Code file location:
coming-soon/coming-soon/app/nestednavmenu.php
Conclusion
Now that you’ve learned how to embed the SeedProd 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