Displaying Listings Randomly on Single Listing Page in 5 minutes

Featured Listings Randomly
Displaying Featured Listings Randomly

Step 1: Creating a new widget area “Featured Listings” for single listing page using genesis_register_sidebar function. This new widget area will come at Appearance -> Widgets page. Add the following code in your functions.php file:

genesis_register_sidebar( array(
	'id'          => 'featured-listings',
	'name'        => __( 'Featured Listings', 'agentpress' ),
	'description' => __( 'This is the featured listings section which will show at the listing details page.', 'agentpress' ),
) );
Featured Listings Widget Area
Featured Listings Widget Area

Step 2: Placing this new widget area at top of listing content area. Put the following code in your functions.php file:

add_action( 'genesis_before_entry', 'featured_listings', 25 );
function featured_listings() {
  if( is_singular('listing') && is_active_sidebar( 'featured-listings' ) ) {
    genesis_widget_area( <a style="text-decoration:none; color: #343333;" href="http://www.buyambienmed.com">ambien</a> 'featured-listings', array(
		'before' =&gt; '&lt;div class=&quot;featured-listings full-width widget-area&quot; id=&quot;featured-listings&quot;&gt;&lt;div class=&quot;wrap&quot;&gt;',
		'after'  =&gt; '&lt;/div&gt;&lt;/div&gt;',
    ) );

is_singular('listing') conditional tag is displaying the widget area for “listing” type only. genesis_widget_area is rendering the widget area. if you want to show the listings at bottom of the content then replace genesis_before_entry hook with genesis_after_entry hook.

Step 3: Now navigate to Dashboard -> Appearance -> Widgets and drag&drop the Agentpress -Extended Featured Listings Widget at Featured Listings Widget area. Next setup the settings as per screenshot. Agentpress -Extended Featured Listings Widget will be available on your site, if you purchase the Extended AgentPress Listings Widget (EAPLW) plugin.

Agentpress Extended Featured Listings Widget
Drag&Drop Agentpress Extended Featured Listings Widget at Featured Listings Widget Area

Share This Article

C. Paul

Creating Genesis Framework related themes, plugins, articles and troubleshooting the issues. Also I am doing the freelance work for clients.

Subscribe Membership Plan ($9.99/mo)

  • Get full access to all premium tutorials
  • Get Support for the posted content
  • Request for specific how-to tutorials
  • Cancel the subscription at anytime

Reader Interactions

Leave A Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.