GD Listings by ID

This topic contains 21 replies, has 6 voices, and was last updated by  Alex Howes 5 years, 11 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #430685

    Paolo
    Site Admin
    Post count: 31206

    You are welcome 🙂

    #430691

    Alex Howes
    Expired Member
    Post count: 175

    Sorry, it isn’t working. It was adding the wrong tag. I’ve written the code:

    
    
    	  $tag = $value;
    	  geodir_save_post_meta( $value, 'post_tags', array( $tag ) );
    	  wp_set_object_terms( $value, array( $tag ), get_post_type( $value ) . '_tags' );
    	  echo do_shortcode('[gd_listings post_type=gd_cv layout=1 tags=$tag]');

    where $value is a string of the listing ID, which I’m also using as a unique tag for the listing. The tag is attached to the listing correctly (I checked the JSON endpoint), so the problem is in the GD listings shortcode. Currently it prints every listing of type gd_cv, rather than just the ones tagged with $tag.

    Is it possibly because it’s looking for literally ‘$tag’ rather than the contents of $tag?

    #430760

    Kiran
    Moderator
    Post count: 7069

    Try this one

    
    
    	  $tag = $value;
    	  geodir_save_post_meta( $value, 'post_tags', array( $tag ) );
    	  wp_set_object_terms( $value, array( $tag ), get_post_type( $value ) . '_tags' );
    	  echo do_shortcode('[gd_listings post_type=gd_cv layout=1 tags=' . $tag . ']');

    Kiran

    #430768

    Dirk
    Full Member
    Post count: 390

    @paolo, @kiran,

    I guess that Paolo is correct. But @kiran:
    How can I understand your posting here:
    https://wpgeodirectory.com/support/topic/event-tags-issue/#post-430479

    Dirk

    #430777

    Kiran
    Moderator
    Post count: 7069

    Hi Dirk,

    You can use this hook to filter listing data being submitted. https://github.com/GeoDirectory/geodirectory/blob/d1298ab275a7e54b36bb1cd33abacda42df66df2/geodirectory-functions/post_functions.php#L173

    You can filter tags (add/remove) from this data.

    Thanks,
    Kiran

    #430780

    Dirk
    Full Member
    Post count: 390

    Hi Kiran,

    thanks for the clarification.

    Best,
    Dirk

    #430803

    Alex Howes
    Expired Member
    Post count: 175

    Great, thanks Kiran, it’s working now 🙂

Viewing 7 posts - 16 through 22 (of 22 total)

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

Open Support Ticket