Home Forums WTI Like Post PRO How do I use the GetWtiLikePost() function

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #597
    atomikt22
    Participant

    When i use the GetWtiLikePost() function in php, it echoes the like section at the top of the page, and all the like sections are nested wihtin each other. Here is my code:

    if($query->have_posts()):
        	$html .= "<div class='posts_wrapper'>";
            while( $query->have_posts() ) : $query->the_post();
                $html .= "<div class='post_wrapper'>";
                $html .= "<a href=\"" . get_permalink() . "\">";
                $html .= "<img src='" . get_the_post_thumbnail_url() . "' />";
                $html .= "</a>";
                $html .= "</div>";
                GetWtiLikePost();
    
            endwhile;
            $html .= "</div>";
        endif;

    And here is the source code (the start of it at least):

    <div class='watch-action'>
    	<div class='watch-position align-left'>
    		<div class='action-like'>
    			<a class='lbg-style1 like-114 jlk' data-task='like' data-post_id='114' data-nonce='ec6cd3a35c' rel='nofollow'>
    				<span class='wti-text'>Yes</span>
    				<div class='action-unlike'>
    					<a class='unlbg-style1-active unlike-114 jlk' data-task='unlike' data-post_id='114' data-nonce='ec6cd3a35c' rel='nofollow'>
    						<span class='wti-text'>No</span>
    					</a>
    				</div>
    			</div> 
    			<div class='status-114 status align-left'>You have already voted.
    			</div>
    		</div>
    		<div class='wti-clear'>
    			
    		</div>
    		<div class='wti-user-likes wti-likes-114'>
    			
    		</div>
    		<div class='watch-action'>
    			<div class='watch-position align-left'>
    				<div class='action-like'>
    					<a class='lbg-style1-active like-85 jlk' data-task='like' data-post_id='85' data-nonce='ec6cd3a35c' rel='nofollow'>
    						<span class='wti-text'>Yes</span>
    						<div class='action-unlike'>
    							<a class='unlbg-style1 unlike-85 jlk' data-task='unlike' data-post_id='85' data-nonce='ec6cd3a35c' rel='nofollow'>
    								<span class='wti-text'>No
    								</span>
    							</a>
    						</div>
    					</div> 
    					<div class='status-85 status align-left'>You have already voted.
    					</div>
    				</div>
    				<div class='wti-clear'>
    					
    				</div>
    				<div class='wti-user-likes wti-likes-85'>
    					<img src="http://localhost/member_test/website/wp-content/uploads/ultimatemember/1/profile_photo-40.png?1510920752" class="func-um_user gravatar avatar avatar-32 um-avatar um-avatar-uploaded" width="32" height="32" alt="Tom Roelants" />like this
    				</div>
    				<div class='watch-action'>
    • This topic was modified 7 years, 1 month ago by atomikt22.
    • This topic was modified 7 years, 1 month ago by Webtechideas.
    #600
    Webtechideas
    Keymaster

    You are creating the html content and appending content to it. But you are directly printing GetWtiLikePost() Try appending the function output like below

    $html .= GetWtiLikePost();

    If the above does not work, try like this

    $html .= GetWtiLikePost('put');

    Do let us know if this worked or not.

    #603
    atomikt22
    Participant

    I reset the options and then it worked. After a bit of trial and error, i found out that setting the option “Show like/unlike counts” to “don’t show” triggers the bug i explained above.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘WTI Like Post PRO’ is closed to new topics and replies.