Agent Press Featured Property Listing Random?

Community Forums Forums Design Tips and Tricks Agent Press Featured Property Listing Random?

This topic is: not resolved

This topic contains 2 replies, has 2 voices, and was last updated by  electricbrick 1 year, 9 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #10705

    jehensley
    Participant

    I’m looking for a way to make the code so that the Featured Listings on the main page will be a random of all of my property listings. I hope someone out there can help me. I currently only have the last 3 listed. Thanks in advance.

    James

    #16134

    electricbrick
    Participant
    Post count: 62

    I’m actually looking to be able to filter mine by property type, which is part of the taxonomy structure I set up. Either way, how can we make these results better filterable than just having what amounts to “recent posts”?

    #25693

    electricbrick
    Participant
    Post count: 62

    @jehensley You’ll want to replace your query args in class-featured-listings-widget.php at line 35 with the code immediately below.


    $query_args = array(
    'post_type' => 'listing',
    'posts_per_page' => $instance['posts_per_page'],
    'orderby' => 'rand',
    'paged' => get_query_var('paged') ? get_query_var('paged') : 1
    );

    I was able to get the Featured Listing widget to filter a specific “Featured Homepage” taxonomy category by changing the query_args portion of class-featured-listings-widget.php:


    $query_args = array(
    'post_type' => 'listing',
    'taxonomy' => 'featured-property',
    'field' => 'slug',
    'term' => 'homepage',
    'posts_per_page' => $instance['posts_per_page'],
    'paged' => get_query_var('paged') ? get_query_var('paged') : 1
    );

    EDIT: Sorry, that was a bit cofunsing. Rewrote so I answered the thread and then my own (hijack) question.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.