วิธีการเพิ่มปุ่ม Share ในหน้า Page ของธีม Newsmag
1) ไปที่ไฟล์ /wp-content/themes/Newsmag/includes/modules/td_module_single.php ให้แก้ไข
if ( ! $this->is_single ) {
return;
}
เปลี่ยนเป็น
if ( ! $this->is_single and ! is_page() ) {
return;
}
เพิ่มเงื่อนไขการแสดงผลในหน้า Page
2) ไปที่ไฟล์ page.php (ถ้าใช้ child theme ก็ copy ไฟล์ page.php จาก Newsmag ไปไว้ที่ Newsmage-child ได้เลย )
while ( have_posts() ) : the_post();
?>
<div class="td-page-header td-pb-padding-side">
<?php echo td_page_generator::get_page_breadcrumbs(get_the_title()); ?>
<h1 class="entry-title td-page-title">
<span><?php the_title() ?></span>
</h1>
<?php
/* เพิ่ม Social media ด้านบน */
$td_mod_single = new td_module_single($post);
echo $td_mod_single->get_social_sharing_top();
?>
</div>
<div class="td-pb-padding-side td-page-content">
<?php the_content(); ?>
</div>
<?php
/* เพิ่ม Social media ด้านล่าง */
echo $td_mod_single->get_social_sharing_bottom();
?>
<?php
endwhile;
ดูตัวอย่างได้ที่ https://ssanetwork.co.th/

