Jump to content

Recommended Posts

Hi experts!

I am not a programmer, just a designer and I have problems with php codes, I would like to display a bundle of Wordpress shortcode below on my website but I unable to make it correct, please help me.

<?php
if ( is_single() ) { 
echo "<div class="pagelink"><?php wp_link_pages('pagelink=trang %'); ?></div><p>"
echo "<div class="fb-like" data-href="https://www.facebook.com/tvvn.net" data-layout="standard" data-action="like" data-show-faces="false" data-share="true"></div><p>"
<?php if(function_exists("kk_star_ratings")) : echo kk_star_ratings($pid); endif; ?><p>
<?php echo do_shortcode("[kpvc_single]"); ?><p>
<?php echo do_shortcode("[fbcomments]"); ?><p>
<?php zemanta_related_posts()?>
} else {}
?>

Each part of the code is correct because it came from the plugin, but I don't known how to make it display at the same place. Could you please help complete Echo etc... the code above.

 

Thanks very much!

TOM

Link to comment
https://forums.phpfreaks.com/topic/294562-please-help-complete-bundle-of-codes/
Share on other sites

There are several issues with the code you've posted, actually. First and foremost, your quote nesting is incorrect and you're leaving plaintext strings in the middle of the echo statements. Also, the php open/close tags don't match up in several places.

<?php
if ( is_single() ) { 
	echo "<div class='pagelink'>".wp_link_pages('pagelink=trang %')."</div><p>";
	echo "<div class='fb-like' data-href='https://www.facebook.com/tvvn.net' data-layout='standard' data-action='like' data-show-faces='false' data-share='true'></div><p>";
	if(function_exists("kk_star_ratings")){
		echo kk_star_ratings($pid);
	}
	echo "<p>".do_shortcode("[kpvc_single]");
	echo "<p>".do_shortcode("[fbcomments]")."<p>";
	zemanta_related_posts();
} else {}
?>

This just fixes the syntax errors in the code you posted - there's no logic work done in the above. For instance, I'm not seeing where $pid is being defined, so if it's not done somewhere higher up in the script, you'll get an undefined error assuming that function kk_star_ratings() exists. I'm not familiar with the Zemanta Related Posts plugin, so I don't know if zemanta_related_posts() will display to screen without an explicit echo statement.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.