Home Forums WTI Like Post PRO Pass the post id

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #130
    easyweddings
    Participant

    Hello,

    I would like to include the widget on my custom templates and I cant figure out how to pass a post id to the widget function. I have tried the followings:
    <?php GetWtiLikePost($post->ID)?>
    <?php GetWtiLikePost(22)?>

    It always seems to be using the post id of the page its is in.

    Thanks

    #131
    Webtechideas
    Keymaster

    This is associated with the content filter so it will load for that content which is being rendered. If you are using any custom code for loading the buttons, you need to make sure that it is placed correctly in the loop. Can you please send the template file you are trying with to support@webtechideas.com? Also please share the specific site link so that we can have a look at that.

    Thanks

    #154
    firefly
    Participant

    It’s a quick change to make this happen. Might be worth rolling into the core?

    wti_like_post_site.php

    line 7: // pass post ID
    function GetWtiLikePost($arg = null, $post_id=NULL)

    Line 9: // use loop ID if post ID not specified
    if($post_id == NULL) $post_id = get_the_ID();

    Line 33: // get categories for post ID
    $category = get_the_category($post_id);

    You can then call:

    GetWtiLikePost(NULL, $post->ID); // echo the output
    GetWtiLikePost(‘put’, $post->ID); // return the output string instead of echo

    GetWtiLikePost(); // will do what it did before the mods

    • This reply was modified 6 years, 2 months ago by firefly.
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘WTI Like Post PRO’ is closed to new topics and replies.