selector for claimed listing status

This topic contains 5 replies, has 3 voices, and was last updated by  Alex Rollin 6 years, 5 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #430387

    Scott Harris
    Lifetime Member
    Post count: 74

    I’d like to be able to target custom fields in the detail page based on claimed or unclaimed status. There’s a filter that lets you add the package id to the body attribute which you wrote about on this page https://wpgeodirectory.com/docs/common-code-snippets/. I was hoping there might be a similar code snippet that would allow targeting of claimed status. Is that possible?

    #430436

    Alex Rollin
    Moderator
    Post count: 27815
    #430552

    Scott Harris
    Lifetime Member
    Post count: 74

    Thanks Alex. That helped me figure out what to do. For future reference, if anyone wants to target claimed status, this snippet worked for me. It adds a body class of either gd-claimed-1 for claimed listings or gd-claimed-0 for unclaimed listings.

    
    
    // add the claimed status to the body
    add_filter( 'body_class', 'my_add_claimed_class',10,1 );
    function my_add_claimed_class($class){
        global $post;
        if (geodir_is_page('detail') && isset($post->claimed)) {
            $class[] = "gd-claimed-".$post->claimed;
        }
        return $class;
    }	
    	
    #430553

    Alex Rollin
    Moderator
    Post count: 27815

    That is Awesome Scott, thanks for sharing.

    #436446

    Akash Choudhary
    Full Member
    Post count: 26

    can you tell us which file we update for the same.where we will paste this code of function.

    #436447

    Alex Rollin
    Moderator
    Post count: 27815

    This can be added as a code snippet:
    https://wpgeodirectory.com/docs/useful-plugins/#snippets

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

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount