Ultimate Product Catalog Shortcodes

Below, you’ll find a detailed guide on how to add the Ultimate Product Catalog 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 Ultimate Product Catalog Plugin shortcodes not to show or not to work correctly.

Before starting, here is an overview of the Ultimate Product Catalog Plugin and the shortcodes it provides:

✩✩✩✩✩ () Active Installs: + Tested with: PHP Version:
Included Shortcodes:

Ultimate Product Catalog [product-catalog] Shortcode

The Ultimate Product Catalogue shortcode is a powerful tool, enabling dynamic product display on your WordPress site. This shortcode, when implemented, pulls product data from your catalogue, allowing you to customize the display based on various attributes. It supports pagination, filtering by price, category, tags, and custom fields. It also allows you to control the layout, number of products per page, and order of display. The shortcode is highly flexible, with options to exclude certain layouts and set a starting layout. The function ‘ewd_upcp_catalog_shortcode’ is the core of this shortcode, which creates a new catalogue view and renders it on the page. This function also allows for extensions via add-ons, making it versatile for varied needs.

Shortcode: [product-catalog]

Parameters

Here is a list of all possible product-catalog shortcode parameters and attributes:

  • id – Unique identifier for the product catalog.
  • excluded_layouts – Specifies layouts not to be used in the catalog.
  • starting_layout – Defines the initial layout of the catalog.
  • products_per_page – Determines the number of products per page.
  • current_page – Identifies the current page number in pagination.
  • sidebar – Enables or disables the sidebar in the catalog.
  • overview_mode – Controls the overview mode of the catalog.
  • omit_fields – Specifies the fields to be omitted from the catalog.
  • ajax_url – Specifies the URL for AJAX calls.
  • category – Defines the product category to be displayed.
  • subcategory – Defines the product subcategory to be displayed.
  • tags – Identifies the product tags to be shown.
  • custom_fields – Allows addition of custom fields to the catalog.
  • prod_name – Specifies the product name to be displayed.
  • max_price – Sets the maximum price limit for the products.
  • min_price – Sets the minimum price limit for the products.
  • orderby – Determines the order of the products based on a field.
  • order – Specifies the sorting order (ascending or descending).

Examples and Usage

Basic example – A simple usage of the shortcode to display a product catalog with the default settings.

[product-catalog id=1 /]

Advanced examples

Display a product catalog while specifying the starting layout, number of products per page, and the category of products to be displayed.

[product-catalog id=1 starting_layout='list' products_per_page='10' category='electronics' /]

Using the shortcode to display a product catalog while excluding certain layouts, specifying the current page, and using a sidebar.

[product-catalog id=1 excluded_layouts='detail' current_page='2' sidebar='yes' /]

Display a product catalog with custom fields, specified product name, and a price range.

[product-catalog id=1 custom_fields='color,size' prod_name='iPhone' min_price='500' max_price='1000' /]

Using the shortcode to display a product catalog with a specified order of products.

[product-catalog id=1 orderby='date' order='desc' /]

PHP Function Code

In case you have difficulties debugging what causing issues with [product-catalog] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'product-catalog', 'ewd_upcp_catalog_shortcode' );

Shortcode PHP function:

function ewd_upcp_catalog_shortcode( $atts ) {
	global $ewd_upcp_controller;

	// Define shortcode attributes
	$catalog_atts = array(
		'id'				=> 1,
		'excluded_layouts'	=> 'none',
		'starting_layout'	=> 'thumbnail',
		'products_per_page'	=> '',
		'current_page'		=> 1,
		'sidebar'			=> '',
		'overview_mode'		=> '',
		'omit_fields'		=> '',
		'ajax_url'			=> '',
		'category'			=> '',
		'subcategory'		=> '',
		'tags'				=> '',
		'custom_fields'		=> '',
		'prod_name'			=> '',
		'max_price'			=> '',
		'min_price'			=> '',
		'orderby'			=> '',
		'order'				=> '',
	);

	// Create filter so addons can modify the accepted attributes
	$catalog_atts = apply_filters( 'ewd_upcp_catalog_shortcode_atts', $catalog_atts );

	// Extract the shortcode attributes
	$args = shortcode_atts( $catalog_atts, $atts );

	// Load the view files
	ewd_upcp_load_view_files();

	$catalog = new ewdupcpViewCatalog( $args );

	$catalog->set_request_parameters();

	$output = $catalog->render();

	return $output;
}

Code file location:

ultimate-product-catalogue/ultimate-product-catalogue/includes/template-functions.php

Ultimate Product Catalog [insert-products] Shortcode

The ‘insert-products’ shortcode of Ultimate Product Catalogue plugin is used to display a minimal set of products. It accepts parameters like ‘catalogue_url’, ‘product_ids’, ‘catalogue_id’, ‘category_id’, ‘subcategory_id’, ‘catalogue_search’, ‘product_count’, and ‘products_wide’. These parameters help in customizing the displayed products. The shortcode first checks if it’s a single product page, if not, it fetches and displays the products based on the given parameters. The ‘product_count’ and ‘products_wide’ parameters control the number of products to display and their arrangement. Overall, this shortcode offers a flexible way to showcase your products.

Shortcode: [insert-products]

Parameters

Here is a list of all possible insert-products shortcode parameters and attributes:

  • catalogue_url – URL of the product catalogue to display
  • product_ids – IDs of specific products to show
  • catalogue_id – ID of the catalogue to pull products from
  • category_id – ID of the category to pull products from
  • subcategory_id – ID of the subcategory to pull products from
  • catalogue_search – Search term to filter catalogue products
  • product_count – Number of products to display per page
  • products_wide – Number of products to display per row

Examples and Usage

Basic example – Displaying products from a specific catalogue by referencing its ID.

[insert-products catalogue_id=2 /]

Advanced examples

Displaying a specific number of products from a specific catalogue by referencing its ID and setting the product count. This will display the first 5 products from the catalogue with the ID of 2.

[insert-products catalogue_id=2 product_count=5 /]

Displaying products from a specific category by referencing its ID. This will display products from the category with the ID of 3.

[insert-products category_id=3 /]

Displaying products from a specific subcategory within a specific category. This will display products from the subcategory with the ID of 4, within the category with the ID of 3.

[insert-products category_id=3 subcategory_id=4 /]

Displaying a specific number of products wide. This will display the products in a grid with 4 products per row.

[insert-products products_wide=4 /]

Combining multiple parameters to display a specific number of products from a specific category in a specific layout. This will display the first 5 products from the category with the ID of 3, in a grid with 4 products per row.

[insert-products category_id=3 product_count=5 products_wide=4 /]

PHP Function Code

In case you have difficulties debugging what causing issues with [insert-products] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'insert-products', 'ewd_upcp_minimal_products_shortcode' );

Shortcode PHP function:

function ewd_upcp_minimal_products_shortcode( $atts ) {
	global $ewd_upcp_controller;

	// Define shortcode attributes
	$insert_products_atts = array(
		'catalogue_url'			=> '',
		'product_ids'			=> '',
		'catalogue_id'			=> '',
		'category_id'			=> '',
		'subcategory_id'		=> '',
		'catalogue_search'		=> '',
		'product_count'			=> 3,
		'products_wide'			=> 3,
	);

	// Create filter so addons can modify the accepted attributes
	$insert_products_atts = apply_filters( 'ewd_upcp_insert_products_shortcode_atts', $insert_products_atts );

	// Extract the shortcode attributes
	$args = shortcode_atts( $insert_products_atts, $atts );

	// Load the view files
	ewd_upcp_load_view_files();

	if ( ( ! empty( get_query_var( 'single_product' ) ) or ! empty( $_GET['SingleProduct'] ) ) and $catalogue_url == '' ) {

		return ewd_upcp_catalog_shortcode( array() );
	}

	$products = new ewdupcpViewMinimalProducts( $args );

	$output = $products->render();

	return $output;
}

Code file location:

ultimate-product-catalogue/ultimate-product-catalogue/includes/template-functions.php

Ultimate Product Catalog [upcp-popular-products] Shortcode

The Ultimate Product Catalogue shortcode is a powerful tool that displays popular products. This shortcode fetches the most popular products from the specified catalogue. It can display up to 3 products by default, but this number can be customized. The ‘catalogue_search’ attribute is set to ‘popular’, ensuring only top-rated items are shown.

Shortcode: [upcp-popular-products]

Parameters

Here is a list of all possible upcp-popular-products shortcode parameters and attributes:

  • catalogue_url – web address of the product catalogue
  • catalogue_id – unique identifier of the product catalogue
  • product_count – the number of popular products to display

Examples and Usage

Basic example – Showcases the usage of the shortcode to display the top three popular products from the catalogue.

[upcp-popular-products product_count=3 /]

Advanced examples

In this example, the shortcode is used to display the top five popular products from a specific catalogue identified by its ID.

[upcp-popular-products catalogue_id=2 product_count=5 /]

This example demonstrates the usage of the shortcode to display the top three popular products, with the results linking back to a specific catalogue URL.

[upcp-popular-products catalogue_url="http://yourwebsite.com/your-catalogue" product_count=3 /]

Finally, this example uses the shortcode to display the top three popular products from a specific catalogue, identified by both its ID and URL. The products will first try to load by ID, but if not found, it will try to load by URL.

[upcp-popular-products catalogue_id=2 catalogue_url="http://yourwebsite.com/your-catalogue" product_count=3 /]

PHP Function Code

In case you have difficulties debugging what causing issues with [upcp-popular-products] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'upcp-popular-products', 'ewd_upcp_popular_products_shortcode' );

Shortcode PHP function:

function ewd_upcp_popular_products_shortcode( $atts ) {

	$defaults = array(
		'catalogue_url'			=> '',
		'catalogue_id'			=> '',
		'product_count'			=> 3,
	);

	$shortcode_atts = shortcode_atts( $defaults, $atts );

	$shortcode_atts['catalogue_search'] = 'popular';

	$output = ewd_upcp_minimal_products_shortcode( $shortcode_atts );

	return $output;
}

Code file location:

ultimate-product-catalogue/ultimate-product-catalogue/includes/template-functions.php

Ultimate Product Catalog [upcp-recent-products] Shortcode

The Ultimate Product Catalogue shortcode is a versatile tool for displaying recent products. This shortcode allows you to showcase the most recent additions to your catalogue. By default, it displays the three most recent products. However, you can customize this number to suit your needs. The ‘catalogue_url’ and ‘catalogue_id’ attributes can be used to specify the catalogue. The ‘product_count’ attribute determines the number of recent products displayed. The shortcode then returns these products in a minimal layout.

Shortcode: [upcp-recent-products]

Parameters

Here is a list of all possible upcp-recent-products shortcode parameters and attributes:

  • catalogue_url – the URL where the catalogue is located
  • catalogue_id – unique identifier of the specific catalogue
  • product_count – the number of recent products to display

Examples and Usage

Basic example – Showcases the three most recent products from the catalogue

[upcp-recent-products product_count=3 /]

Advanced examples

Display the five most recent products from a specific catalogue by referencing the catalogue_id. If the catalogue_id is not found, it will not return any products.

[upcp-recent-products catalogue_id=2 product_count=5 /]

Render the recent products from a catalogue by using the catalogue_url. This is useful when the catalogue_id is not known or changes frequently. If the catalogue_url is not found, it will not return any products.

[upcp-recent-products catalogue_url="http://www.example.com/my-catalogue" product_count=4 /]

PHP Function Code

In case you have difficulties debugging what causing issues with [upcp-recent-products] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'upcp-recent-products', 'ewd_upcp_recent_products_shortcode' );

Shortcode PHP function:

function ewd_upcp_recent_products_shortcode( $atts ) {

	$defaults = array(
		'catalogue_url'			=> '',
		'catalogue_id'			=> '',
		'product_count'			=> 3,
	);

	$shortcode_atts = shortcode_atts( $defaults, $atts );

	$shortcode_atts['catalogue_search'] = 'recent';

	$output = ewd_upcp_minimal_products_shortcode( $shortcode_atts );

	return $output;
}

Code file location:

ultimate-product-catalogue/ultimate-product-catalogue/includes/template-functions.php

Ultimate Product Catalog [upcp-random-products] Shortcode

The Ultimate Product Catalogue shortcode, ‘upcp-random-products’, displays a random selection of products from your catalogue. It takes three parameters: ‘catalogue_url’, ‘catalogue_id’, and ‘product_count’. By default, it displays three products randomly. You can customize the number of products displayed by changing the ‘product_count’ value. It’s an effective tool for showcasing different products each time your page loads, enhancing user experience.

Shortcode: [upcp-random-products]

Parameters

Here is a list of all possible upcp-random-products shortcode parameters and attributes:

  • catalogue_url – URL of the specific product catalogue.
  • catalogue_id – Unique identifier of the product catalogue.
  • product_count – Number of random products to display.

Examples and Usage

Basic Example – Displays a random selection of three products from the catalogue.

[upcp-random-products]

Advanced Examples

Displays a random selection of five products from the catalogue. The ‘product_count’ attribute specifies the number of products to display.

[upcp-random-products product_count=5]

Displays a random selection of products from a specific catalogue. The ‘catalogue_id’ attribute specifies the ID of the catalogue from which to select products.

[upcp-random-products catalogue_id=2]

Displays a random selection of products and links them to a specific URL. The ‘catalogue_url’ attribute specifies the URL to which the products will be linked.

[upcp-random-products catalogue_url="https://www.example.com/"]

Displays a random selection of three products from a specific catalogue and links them to a specific URL. It combines the ‘catalogue_id’, ‘product_count’, and ‘catalogue_url’ attributes.

[upcp-random-products catalogue_id=2 product_count=3 catalogue_url="https://www.example.com/"]

PHP Function Code

In case you have difficulties debugging what causing issues with [upcp-random-products] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'upcp-random-products', 'ewd_upcp_random_products_shortcode' );

Shortcode PHP function:

function ewd_upcp_random_products_shortcode( $atts ) {

	$defaults = array(
		'catalogue_url'			=> '',
		'catalogue_id'			=> '',
		'product_count'			=> 3,
	);

	$shortcode_atts = shortcode_atts( $defaults, $atts );

	$shortcode_atts['catalogue_search'] = 'rand';

	$output = ewd_upcp_minimal_products_shortcode( $shortcode_atts );

	return $output;
}

Code file location:

ultimate-product-catalogue/ultimate-product-catalogue/includes/template-functions.php

Ultimate Product Catalog [upcp-search] Shortcode

The Ultimate Product Catalogue shortcode is a powerful tool that enables a search function in your catalogue. It dynamically creates a form, allowing users to input a product name. The form then redirects to the catalogue URL, displaying search results. The shortcode also allows customization of labels and placeholders, providing a flexible user experience.

Shortcode: [upcp-search]

Parameters

Here is a list of all possible upcp-search shortcode parameters and attributes:

  • catalogue_url – URL of the product catalogue to be searched
  • search_label – Text label for the search field
  • search_placeholder – Placeholder text inside the search field
  • submit_label – Text label for the search button

Examples and Usage

Basic example – A simple usage of the shortcode to render a search form for the Ultimate Product Catalogue. The form will use the default labels and placeholder text.

[upcp-search /]

Advanced examples

Customizing the labels and placeholder text for the search form. This example shows how to set the ‘search_label’, ‘search_placeholder’, and ‘submit_label’ attributes to customize the text displayed in the search form.

[upcp-search search_label="Find" search_placeholder="Enter product name..." submit_label="Go" /]

Specifying a catalogue URL for the search form. This example demonstrates how to set the ‘catalogue_url’ attribute to determine where the search results will be displayed.

[upcp-search catalogue_url="http://yourwebsite.com/your-catalogue/" /]

Combining multiple attributes in a single shortcode. This example combines the ‘catalogue_url’ attribute with the ‘search_label’, ‘search_placeholder’, and ‘submit_label’ attributes to fully customize the search form and its behavior.

[upcp-search catalogue_url="http://yourwebsite.com/your-catalogue/" search_label="Find" search_placeholder="Enter product name..." submit_label="Go" /]

PHP Function Code

In case you have difficulties debugging what causing issues with [upcp-search] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'upcp-search', 'ewd_upcp_search_shortcode' );

Shortcode PHP function:

function ewd_upcp_search_shortcode( $atts ) {

	$ewd_upcp_search_atts = array(
		'catalogue_url'			=> '',
		'search_label'			=> 'Search',
		'search_placeholder'	=> 'Search...',
		'submit_label'			=> 'Search',
	);

	$args = shortcode_atts( $ewd_upcp_search_atts, $atts );

	$output = "<div class='ewd-upcp-product-search-widget-div'>";
	$output .= "<form method='post' action='" . esc_attr( add_query_arg( 'overview_mode', 'None', $args['catalogue_url'] ) ) . "'>";
	$output .= "<div class='ewd-upcp-widget-search-label'>" . sanitize_text_field( $args['search_label'] ) . "</div>";
	$output .= "<div class='ewd-upcp-widget-search-input'><input type='text' name='prod_name' placeholder='" . esc_attr( $args['search_placeholder'] ) . "'/></div>";
	$output .= "<input type='submit' class='ewd-upcp-widget-submit' name='upcp_widget_search_submit' value='" . esc_attr( $args['submit_label'] ) . "' />";
	$output .= "</form>";
	$output .= "</div>";

	return $output;
}

Code file location:

ultimate-product-catalogue/ultimate-product-catalogue/includes/template-functions.php

Conclusion

Now that you’ve learned how to embed the Ultimate Product Catalog 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.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *