首先,我甚至不确定这篇文章的合适标题,我只是尝试在php文件中添加社交按钮类,但它不起作用或给出语法错误。以下是我想要社交代码的代码。
这实际上是一个投资组合,当你点击图像时,它会缩小,我想显示社交图标来分享图片..
码
if (!function_exists('photoswipe_wrapper')) {
function photoswipe_wrapper( $atts ) {
echo '
<div id="gallery" class="pswp" tabindex="-1" role="dialog" aria-hidden="true">
<div class="pswp__bg"></div>
<div class="pswp__scroll-wrap">
<div class="pswp__container">
<div class="pswp__item"></div>
<div class="pswp__item"></div>
<div class="pswp__item"></div>
</div>
<div class="pswp__ui pswp__ui--hidden">
<div class="pswp__top-bar">
<div class="pswp__counter"></div>
<button class="pswp__button pswp__button--close" title="Close (Esc)"></button>
<button class="pswp__button pswp__button--share" title="Share"></button>
<button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>
<button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>
<div class="pswp__preloader">
<div class="pswp__preloader__icn">
<div class="pswp__preloader__cut">
<div class="pswp__preloader__donut"></div>
</div>
</div>
</div>
</div>
<!-- <div class="pswp__loading-indicator"><div class="pswp__loading-indicator__line"></div></div> -->
<div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
<div class="pswp__share-tooltip">
<!-- <a href="#" class="pswp__share--facebook"></a>
<a href="#" class="pswp__share--twitter"></a>
<a href="#" class="pswp__share--pinterest"></a>
<a href="#" download class="pswp__share--download"></a> -->
</div>
</div>
<button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)"></button>
<button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)"></button>
<div class="pswp__caption">
<div class="pswp__caption__center">
</div>
</div>
</div>
</div>
</div>' ;
}
add_action('wp_footer','photoswipe_wrapper');
}
这是我想在上面的代码中添加的社交代码
$output .= '<div class="gallery-side-heading-wrap portfolio-share clearfix"><h6 class="gallery-side-heading">'.__('Share This', 'be-themes').'</h6>';
$output .= '<p>';
$output .= be_get_share_button(get_permalink($post->ID), get_the_title($post->ID) , $post->ID);
$output .= '</p></div>';