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;
ihor
April 1, 2025, 10:28am
5
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
system
Closed
May 2, 2025, 8:36am
7
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.