Advanced Random Posts Widget Shortcode

Below, you’ll find a detailed guide on how to add the Advanced Random Posts Widget 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 Advanced Random Posts Widget Plugin shortcode not to show or not to work correctly.

Before starting, here is an overview of the Advanced Random Posts Widget Plugin and the shortcodes it provides:

Plugin Icon
Advanced Random Posts Widget

"Advanced Random Posts Widget is a WordPress plugin that randomly displays your blog posts, enhancing user engagement and content discovery on your site."

★★★★✩ (39) Active Installs: 20000+ Tested with: 6.1.4 PHP Version: false
Included Shortcodes:
  • [arpw]

Advanced Random Posts Widget [arpw] Shortcode

The Advanced Random Posts Widget (arpw) shortcode is designed to fetch and display random posts. It uses attributes to customize the output. Firstly, the shortcode attributes are fetched and set as per the default arguments. It then loads the default style using ‘wp_enqueue_style’. Finally, it returns random posts using ‘arpw_get_random_posts’ function.

Shortcode: [arpw]

Examples and Usage

Basic example – The following shortcode will display random posts using the default settings of the Advanced Random Posts Widget plugin:

[arpw]

PHP Function Code

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

Shortcode line:

add_shortcode( 'arpw', 'arpw_shortcode' );

Shortcode PHP function:

function arpw_shortcode( $atts ) {

	// Get shortcode attr
	$args = shortcode_atts( arpw_get_default_args(), $atts );

	// Load default style
	wp_enqueue_style( 'arpw-style' );

	// Display the shortcode content
	return arpw_get_random_posts( $args, get_the_ID() );

}

Code file location:

advanced-random-posts-widget/advanced-random-posts-widget/includes/shortcode.php

Conclusion

Now that you’ve learned how to embed the Advanced Random Posts Widget 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.

Comments

Leave a Reply

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