WordPress.org

Support

Support » Plugins and Hacks » [Resolved] get automaticly post author ID

[Resolved] get automaticly post author ID

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Gabriel
    Participant

    @designbymerovingi

    Hi.

    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;

    <?php
    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 ?

    Plugin Author Gabriel
    Participant

    @designbymerovingi

    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 🙂

    Plugin Author Gabriel
    Participant

    @designbymerovingi

    Excellent news! Thank you for keeping me updated!

    Hi,
    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

    Got it to work now.
    The solution was adding filter code into theme function.

    Sorry

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Resolved] get automaticly post author ID’ is closed to new replies.