How to display listing id in custom attribute?

I created custom shortcode to be used in my custom atttribute display, inspired from this post:

hxxps://community.hivepress.io/t/change-value-token-output-to-lowercase-for-url/15144/4

But my custom shortcode needs post_id of current listing. How to extract those id? as far as i know the display token is very limited to: %value%, %parent_value%, and %icon%

Do your homework, search on Google.

global $post;
echo $post->ID;

This depends on how the shortcode is implemented, but if it’s always used within the listing page, then get_the_ID() may work.

Sorry i mean hivepress way not wordpress way.
But I already found it:

hivepress()->request->get_context( 'listing' )->get_id();

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.