• Hello Pets community!

    (I already have already bothered the developer with a long wish list and he’s been super helpful but understandably busy, and so mainly aiming these questions at the rest of the community in case someone has found a workaround that I can use in the meantime:)

    1. On my main page, instead of showing 1 random dog at a time, I would like to show a few random dogs from a searchable Field that I’ve defined as urgent/not urgent (by adapting the single random pet shortcode) or possibly all dogs in this category (by adapting the pets_archive shortcode). I’ve tried to adapt the pets_archive shortcode for this, starting simply by seeing if I could preset the Breed for example (which I thought should be 1 step easier than a Field that has been defined manually), but even that I’ve not managed. Any tips?

    2. How have others dealt with pets that have been adopted and so shouldn’t be published, searchable or visible on your site, but you don’t quite want to throw away the page in case the dog (sadly) gets abandoned later on? We’ve been keeping them as drafts though this becomes quite a mess over time.. (To illustrate: we have 400 dogs at a time on the website and about 40 each month get adopted and replaced with new ones, so that’s 40 dogs moved to ‘draft’ each month..)

    As I guess we’re all in it for the same reason (animal rescue), hoping we can work together as a community to resolve some of our common questions!

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter lboon

    (@lboon)

    To follow up on my question under number 1, I’m trying to adapt the pets_archive shortcode. So far, I’ve been able to change it to only show 3 specific dogs:

    $pets_query = new WP_Query( array(
    ‘post_type’ => ‘pets’,
    ‘post_status’ => ‘publish’,
    ‘post__in’ => array( 2155, 8926, 1992 ),
    ));

    What I would like is to show all dogs of which a given Field has been set to a given Value. Any ideas on how I could do that? I’ve tried by squeezing ‘key’ and ‘value’ into this, but then the page gives an error. Thanks!

    Plugin Author Igor Benic

    (@ibenic)

    Hi @lboon,

    the next update 1.4.0 contains new attributes in pets_archive

    Example:

    [pets_archive filter=adopted filter_value=0] Will show only those that are not adopted. Pets will still be visible and public, but will not be able to be searched here.

    As well, if you go to Pets > Settings and under Search Filter, set the Adopted to NO. This will then filter the global search on /pets and not show pets that were adopted.

    For your other scenario:

    [pets_archive limit=3 orderby=rand hide_nav] -> Show 3 random pets without pagination.

    Thread Starter lboon

    (@lboon)

    This is fantastic and is exactly what I was looking for! It works great, thanks so much! I just had one follow up question: if one of my ‘options’ is quite long and has spaces in its name, how do I refer to that in a filter in the shortcode? E.g. ‘No longer adoptable’ I’ve tried with quotation marks, with spaces, without spaces, with ‘-‘ instead of spaces, using only the first word,.. Thanks!

    Plugin Author Igor Benic

    (@ibenic)

    Hi @lboon it uses the field slug not the title. So for the title, you can have it with spaces, but for the field slug, you can put no_longer_adoptable (same as articles/posts have their slugs created for URL).

    Thread Starter lboon

    (@lboon)

    Thanks! The field value with “quotation marks” and spaces in between worked perfectly! However, I noticed the limit=10 function doesn’t seem to work for me. The hide_nav works, the random function works as well, but the number of posts shown is always the same as it is on the regular Pets page. Anything I can do to make this work?

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Filter [pets_archive]’ is closed to new replies.