• Resolved ChrisHPZ

    (@chrishpz)


    In my feverish efforts in working with this plugin, I was wondering if there is a way to only show certain categories based on a condition. I have some code that works similar to the Featured Listings widget, except that it’s hard coded into one of the template files. Essentially what it does is show the Featured Listings. I’d like to show the category as well.

    <?php
    // Get all listings that are featured listings
    $listings = get_posts(array(
    'post_type' => WPBDP_POST_TYPE,
    'meta_query' => array(
    array('key' => '_wpbdp[sticky]',
    'value' => 'sticky' ) ) ) );
    
    // Iterate through results
    $featured_listings_length = count($listings);
    $iteration = 0;
    
    while($iteration < $featured_listings_length) {
    $event = $values[$iteration];
    $iteration++;
    }
    ?>

    https://www.ads-software.com/plugins/business-directory-plugin/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Business Directory Plugin

    (@businessdirectoryplugin)

    Hi Chris,

    I’m not clear on your goal here–what condition are you trying to display the categories under? What I see above isn’t conditional for category display.

    Can you explain the higher-level goal and maybe I can suggest a better approach?

    Thread Starter ChrisHPZ

    (@chrishpz)

    The condition would be if a category has featured listings, display the category and its featured listings. I was looking around in the database for anything that would differentiate normal listings and featured listings, but to no avail.

    Plugin Author Business Directory Plugin

    (@businessdirectoryplugin)

    See my previous post on how to find featured listings (in your other thread), that may be what you need here.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Display Categories based on certain condition’ is closed to new replies.