我想在我的帖子中添加社交共享按钮,但我不想在我的所有内容文件中添加那么多代码。我想创建一个函数,然后将函数名添加到我的模板文件中,如下所示:
function pietergoosen_sosiale_netwerk_deel_knoppies() {
<strong>Deel die pos met ander</strong><p </p>
<a href="http://www.facebook.com/sharer.php?u=<?php the_permalink();?>&amp;t=<?php the_title(); ?>" title="Share on Facebook.">
<img src="<?php bloginfo(\'stylesheet_directory\'); ?>/images/facebook.png" alt="Share on Facebook" id="sharethis-last" /></a>
<a href="http://twitter.com/home/?status=<?php the_title(); ?> : <?php the_permalink(); ?>" title="Tweet this!">
<img src="<?php bloginfo(\'stylesheet_directory\'); ?>/images/twitter.png" alt="Tweet this!" /></a>
<a href="http://www.google.com/bookmarks/mark?op=edit&bkmk=<?php the_permalink();?>&amp;t=<?php the_title(); ?>" title="Google+1.">
<img src="<?php bloginfo(\'stylesheet_directory\'); ?>/images/google.png" alt="Google+1" id="Google+1" /></a>
<a href="http://www.stumbleupon.com/submit?url=<?php the_permalink(); ?>&amp;title=<?php the_title(); ?>" title="StumbleUpon.">
<img src="<?php bloginfo(\'stylesheet_directory\'); ?>/images/stumbleupon.png" alt="StumbleUpon" /></a>
<a href="http://digg.com/submit?phase=2&amp;url=<?php the_permalink(); ?>&amp;title=<?php the_title(); ?>" title="Digg this!">
<img src="<?php bloginfo(\'stylesheet_directory\'); ?>/images/digg.png" alt="Digg This!" /></a>
<a href="http://del.icio.us/post?url=<?php the_permalink(); ?>&amp;title=<?php the_title(); ?>" title="Bookmark on Delicious.">
<img src="<?php bloginfo(\'stylesheet_directory\'); ?>/images/delicious.png" alt="Boekmerk op Delicious" /></a>
<a href="https://mail.google.com/mail/?view=cm&fs=1&to&su=<?php the_permalink();?>&amp;t=<?php the_title(); ?>" title="epos.">
<img src="<?php bloginfo(\'stylesheet_directory\'); ?>/images/gmail.png" alt="epos" id="epos dit" /></a> }
这不管用。我应该如何正确地执行它?