【发布时间】:2018-04-05 13:56:45
【问题描述】:
我很好奇将社交媒体 SVG 图标添加到页面和帖子类型(不使用插件)是否是最佳实践?
我在 WordPress 页面和帖子中添加了三个自定义字段。 facebook、twitter 和 google plus 字段 我添加了 WordPress 提供的 SVG 标签,这些标签特定于每个社交媒体网站。 wordpress page admin screenshot
这是我添加到首页的代码,我需要在其中添加社交分享图标
<header class="entry-header-hp">
<div class="page-title-homepage">
<?php the_title( '<h2 class="entry-title">', '</h2>' ); ?>
<nav class="social-naviation-news" role="navigation">
<div>
<ul>
<li>
<a href="http://www.facebook.com/sharer/sharer.php?s=100&p[url]=<?php echo urlencode(get_permalink()); ?>" target="_blank"><?php echo the_field('facebook'); ?>
</a>
</li>
<li>
<a href="https://twitter.com/intent/tweet?text=<?php echo urlencode(get_the_title()); ?>+<?php echo get_permalink(); ?>" target="_blank">
<?php echo the_field('twitter'); ?>
</a>
</li>
<li>
<a href="https://plus.google.com/share?url=<?php echo urlencode(get_permalink()); ?>" target="_blank">
<?php echo the_field('Google'); ?>
</a>
</li>
</ul>
</div>
</nav>
</div>
<div class="entry-meta">
<?php echo the_modified_date(); ?>
</div><!-- .entry-meta -->
<div class="edit-link">
<?php twentyseventeen_edit_link( get_the_ID() ); ?>
</div>
</header><!-- .entry-header -->
如您所见,图标将显示在首页上。 https//staging.rockimages.com
这是一个好方法还是会导致任何问题?
【问题讨论】:
标签: wordpress svg wordpress-theming custom-wordpress-pages social-media