Home Forums Responsive Themes Directory Theme Styling featured listings Reply To: Styling featured listings

  • JamesD
    March 15, 2019 at 12:54 am

    Yes, I understand what you’re saying, but it’s not as simple or straightforward as you may think.

    Try this… open the content-listing.php file that you copied from the other post (starting around line #18).
    Look for this portion of code in the file:
    if(!is_numeric($starrating)){ $starrating = 0; }

    <div class="col-md-4 col-sm-6">
    <div class="listing-grid-item bg-dark <?php if(get_post_meta($post->ID,'map-lat', true) != ""){ ?>map-item<?php } ?>" data-marker-id="<?php echo $post->ID; ?>">

    And replace it with:
    if(!is_numeric($starrating)){ $starrating = 0; }
    $css_class = (get_post_meta($post->ID,'featured',true) == "yes" || get_post_meta($post->ID,'featured',true) == 1)?'bg-success':'bg-dark';

    <div class="col-md-4 col-sm-6">
    <div class="listing-grid-item <?= $css_class;?> <?php if(get_post_meta($post->ID,'map-lat', true) != ""){ ?>map-item<?php } ?>" data-marker-id="<?php echo $post->ID; ?>">

    Note: Change bg-success to the style class you want the background color to be. If you don’t have a class name with your color then just create one and use that name in the code above.

  • Copyright © 2010-2020 PremiumPress Limited.

    secure payments