Below, you’ll find a detailed guide on how to add the Reseller Store 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 Reseller Store Plugin shortcodes not to show or not to work correctly.
Before starting, here is an overview of the Reseller Store Plugin and the shortcodes it provides:
"Reseller Store is a powerful WordPress plugin that enables you to effortlessly set up and manage your own online reselling business, streamlining product management and sales processes."
- [rstore-domain-search]
- [rstore_cart_button]
- [rstore_product]
- [rstore_login]
- [rstore_domain_transfer]
- [rstore_domain]
- [rstore_icon]
Reseller Store [rstore-domain-search] Shortcode
The ‘rstore-domain-search’ shortcode is a function in the reseller-store plugin that initiates a domain search. This shortcode wraps the domain search widget within a div class and returns the widget with the specified attributes. It simplifies the process of integrating a domain search feature on a WordPress site.
Shortcode: [rstore-domain-search]
Examples and Usage
Basic example – Enables the display of a domain search widget on your website.
[rstore-domain-search]
PHP Function Code
In case you have difficulties debugging what causing issues with [rstore-domain-search]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'rstore-domain-search', array( $this, 'domain_search' ) );
Shortcode PHP function:
function domain_search( $atts ) {
$this->args['before_widget'] = '<div class="widget rstore-domain">';
$domain = new Widgets\Domain_Search();
return $domain->widget( $this->args, $atts );
}
Code file location:
reseller-store/reseller-store/includes/class-shortcodes.php
Reseller Store [rstore_cart_button] Shortcode
The ‘rstore_cart_button’ shortcode is a function in the reseller-store plugin that allows you to add a cart button to your website. This shortcode creates a widget area, designated as ‘rstore-cart’, where the cart button is displayed. The function ‘cart_button’ takes attributes and returns the cart widget with these attributes. It’s a convenient way to customize and control the display of your shopping cart button.
Shortcode: [rstore_cart_button]
Examples and Usage
Basic example – This shortcode is used to display the cart button for the reseller store plugin.
[rstore_cart_button /]
Advanced examples
Here, we are using the shortcode to display the cart button with additional parameters. The ‘id’ parameter is used to specify a unique identifier for the button, and the ‘class’ parameter is used to apply CSS styling to the button.
[rstore_cart_button id="myCartButton" class="customClass" /]
In this example, we are using the shortcode to display the cart button with a ‘before_widget’ parameter. This parameter is used to specify HTML content that should be displayed before the widget.
[rstore_cart_button before_widget="This is some content that will display before the widget." /]
PHP Function Code
In case you have difficulties debugging what causing issues with [rstore_cart_button]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'rstore_cart_button', array( $this, 'cart_button' ) );
Shortcode PHP function:
function cart_button( $atts ) {
$this->args['before_widget'] = '<div class="widget rstore-cart">';
$cart = new Widgets\Cart();
return $cart->widget( $this->args, $atts );
}
Code file location:
reseller-store/reseller-store/includes/class-shortcodes.php
Reseller Store [rstore_product] Shortcode
The ‘rstore_product’ shortcode is a dynamic tool used to display a specific product within a widget. It calls the ‘product’ function, which creates a ‘Product’ widget and returns it.
Shortcode: [rstore_product]
Examples and Usage
Basic example – The given shortcode is utilized to display a particular product on your WordPress site.
[rstore_product id=1 /]
In the above example, the shortcode is being used to display the product with an ID of 1. The ID parameter can be replaced with the actual ID of the product you wish to display.
Advanced examples
Display a product using both ID and title. The product will first try to load by ID, but if not found, it will try to load by title.
[rstore_product id=1 title="Product Title" /]
In the above example, the product with an ID of 1 is being displayed. If a product with this ID does not exist, the product with the title “Product Title” will be displayed instead.
Display a product with additional parameters such as ‘show_price’ and ‘show_add_to_cart_button’.
[rstore_product id=1 show_price=true show_add_to_cart_button=true /]
In this example, not only is the product with an ID of 1 being displayed, but the price of the product and an ‘Add to Cart’ button are also being shown. By setting the ‘show_price’ and ‘show_add_to_cart_button’ parameters to true, these elements are displayed along with the product.
PHP Function Code
In case you have difficulties debugging what causing issues with [rstore_product]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'rstore_product', array( $this, 'product' ) );
Shortcode PHP function:
function product( $atts ) {
$this->args['before_widget'] = '<div class="widget rstore-product">';
$product = new Widgets\Product();
return $product->widget( $this->args, $atts );
}
Code file location:
reseller-store/reseller-store/includes/class-shortcodes.php
Reseller Store [rstore_login] Shortcode
The Reseller Store plugin shortcode, ‘rstore_login’, allows users to log in to their accounts. This shortcode is implemented through a function that creates a login widget. The function ‘login’ executes the shortcode, initializing a new instance of the Login widget. The ‘before_widget’ argument wraps the widget with a div class for styling. The function then returns the login widget.
Shortcode: [rstore_login]
Examples and Usage
Basic example – The basic usage of the ‘rstore_login’ shortcode. This shortcode will display the login widget without any additional parameters or attributes.
[rstore_login /]
Advanced examples
Adding additional parameters to the ‘rstore_login’ shortcode can customize the display and functionality of the login widget. In the example below, we’re adding a ‘redirect’ attribute. This attribute can be used to specify a URL where the user will be redirected after a successful login.
[rstore_login redirect="http://example.com/welcome" /]
Multiple attributes can also be added to the shortcode. In this example, we’re using the ‘redirect’ attribute as well as a ‘label’ attribute. The ‘label’ attribute can be used to customize the text displayed on the login button.
[rstore_login redirect="http://example.com/welcome" label="Sign In" /]
Please note that the values for the ‘redirect’ and ‘label’ attributes in these examples are just placeholders. Make sure to replace them with your own values when implementing the shortcode.
PHP Function Code
In case you have difficulties debugging what causing issues with [rstore_login]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'rstore_login', array( $this, 'login' ) );
Shortcode PHP function:
function login( $atts ) {
$this->args['before_widget'] = '<div class="widget rstore-login">';
$login = new Widgets\Login();
return $login->widget( $this->args, $atts );
}
Code file location:
reseller-store/reseller-store/includes/class-shortcodes.php
Reseller Store [rstore_domain_transfer] Shortcode
The Reseller Store plugin shortcode ‘rstore_domain_transfer’ is designed to enable domain transfer functionality on your WordPress site. This shortcode initiates a widget that allows users to transfer their existing domains.
Shortcode: [rstore_domain_transfer]
Examples and Usage
Basic example – The given shortcode is used to transfer a domain. It doesn’t require any parameters or attributes to function. Here is a simple usage example:
[rstore_domain_transfer /]
PHP Function Code
In case you have difficulties debugging what causing issues with [rstore_domain_transfer]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'rstore_domain_transfer', array( $this, 'domain_transfer' ) );
Shortcode PHP function:
function domain_transfer( $atts ) {
$this->args['before_widget'] = '<div class="widget rstore-domain-transfer">';
$domain = new Widgets\Domain_Transfer();
return $domain->widget( $this->args, $atts );
}
Code file location:
reseller-store/reseller-store/includes/class-shortcodes.php
Reseller Store [rstore_domain] Shortcode
The Reseller Store shortcode ‘rstore_domain’ is used to display a simple domain search widget. It generates a search bar where users can check domain availability. The associated PHP function ‘domain_simple’ creates a new domain search widget instance. It wraps the widget in a ‘div’ with a class of ‘widget rstore-domain’ for styling purposes.
Shortcode: [rstore_domain]
Examples and Usage
Basic example – An instance of the shortcode without any attributes. This will display the domain in its simplest form.
[rstore_domain]
Advanced examples
Example 1: Using the shortcode with one attribute. This will display the domain with a specific style defined in the ‘style’ attribute.
[rstore_domain style="custom-style"]
Example 2: Using the shortcode with multiple attributes. This will display the domain with a specific style and also a custom class defined in the ‘class’ attribute.
[rstore_domain style="custom-style" class="custom-class"]
Note: The ‘style’ and ‘class’ attributes are just examples. The actual attributes will depend on the implementation of the ‘domain_simple’ function in the plugin.
PHP Function Code
In case you have difficulties debugging what causing issues with [rstore_domain]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'rstore_domain', array( $this, 'domain_simple' ) );
Shortcode PHP function:
function domain_simple( $atts ) {
$this->args['before_widget'] = '<div class="widget rstore-domain">';
$domain = new Widgets\Domain_Simple();
return $domain->widget( $this->args, $atts );
}
Code file location:
reseller-store/reseller-store/includes/class-shortcodes.php
Reseller Store [rstore_icon] Shortcode
The ‘rstore_icon’ shortcode from the Reseller-Store plugin allows users to display product icons in their posts. It takes two attributes: ‘post_id’ and ‘class’. If ‘post_id’ is set, it retrieves the product associated with that ID. If the product is published and belongs to the Reseller_Store post type, it returns the product icon. If not, it displays an error message. If ‘post_id’ is not set, it checks for the ‘icon’ attribute. If ‘icon’ is set, it returns the specified icon. If not, it returns a default icon. The ‘class’ attribute allows users to add a CSS class to the icon for styling purposes.
Shortcode: [rstore_icon]
Parameters
Here is a list of all possible rstore_icon shortcode parameters and attributes:
class
– Specifies the CSS class of the product iconpost_id
– Represents the unique id of the product posticon
– Determines the type of icon to be displayed
Examples and Usage
Basic example – Showcases the usage of the ‘rstore_icon’ shortcode with a specific post_id.
[rstore_icon post_id=123 /]
Advanced examples
Using the shortcode to display a product icon by referencing both post_id and class. If the product post is found, it will display the product icon with the specified CSS class.
[rstore_icon post_id=123 class="custom-class" /]
Using the shortcode to display a default or specified icon with a custom CSS class. If no post_id is provided, it will display the specified icon or a default one if not specified.
[rstore_icon icon="star" class="custom-class" /]
PHP Function Code
In case you have difficulties debugging what causing issues with [rstore_icon]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'rstore_icon', array( $this, 'product_icon' ) );
Shortcode PHP function:
function product_icon( $atts ) {
$class_name = isset( $atts['class'] ) ? $atts['class'] : '';
if ( isset( $atts['post_id'] ) ) {
$post_id = $atts['post_id'];
$product = get_post( $post_id );
if ( null === $product || 'publish' !== $product->post_status ||
\Reseller_Store\Post_Type::SLUG !== $product->post_type ) {
return esc_html__( 'Post id is not valid.', 'reseller-store' );
}
return Product_Icons::get_product_icon( $product, 'icon', $class_name );
} else {
$icon = isset( $atts['icon'] ) ? $atts['icon'] : 'default';
return Product_Icons::get_icon( $icon, $class_name );
}
}
Code file location:
reseller-store/reseller-store/includes/class-shortcodes.php
Conclusion
Now that you’ve learned how to embed the Reseller Store 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