• Resolved fcpro

    (@fcpro)


    Hi,
    How can we get automaticly the “post author ID” using this shortcode ?

    [mycred_post_view user_id=”GET USER POST” amount=”-0.15″ limit=”1″ log=”visit IP” ref=”IP_Visitor” ]

    Thank you in advance.

    https://wordpress.org/plugins/mycred/

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

    (@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;
    Thread Starter fcpro

    (@fcpro)

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

    (@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.

    Thread Starter fcpro

    (@fcpro)

    Yes I got it to work without the ‘ before and after: . $post->ID .
    Like this: user_id=” . $post->ID . “

    Thank you 🙂

    Plugin Author myCred

    (@designbymerovingi)

    Excellent news! Thank you for keeping me updated!

    Thread Starter fcpro

    (@fcpro)

    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

    Thread Starter fcpro

    (@fcpro)

    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 ‘get automaticly post author ID’ is closed to new replies.