Depending on how your mycred_post_view shortcode is setup, it would be easiest to get the post ID in that shortcode.
For example adding the following to the code that renders the shortcode:
global $post; $post_id = $post->ID;
echo do_shortcode( ‘[mycred_post_view user_id=”3″ amount=”-0.20″ limit=”1″ log=”visite IP unique” ref=”IP Visitor” ]’ );
Coding is directly in the file template.
Is that what you mean by set up ?
You can use:
<?php global $post; echo do_shortcode( '[mycred_post_view user_id="' . $post->ID . '" amount="-0.20" limit="1" log="visite IP unique" ref="IP Visitor" ]' ); ?>
As long as this is done inside the loop.
Yes I got it to work without the ‘ before and after: . $post->ID .
Like this: user_id=” . $post->ID . “
Thank you 🙂
Excellent news! Thank you for keeping me updated!
For some reasons I can’t get the shorcode above (mycred_post_view user post->ID) to work anymore on an other (different) website. It’s very strange !?
I’m trying to insert php shortcode into custom post type (single biz listing)
So I’m trying to remember: is there any thing else I needed to do (filter in theme function) or active hooks or addons !?
Can you help me
- The topic ‘get automaticly post author ID’ is closed to new replies.