Side bar Area
近期文章
近期留言
Phil Collins – If leaving me is easy

Bridge – 建立”上下篇文章” 連結

Bridge – 建立”上下篇文章” 連結

難以想像

都到了2019年底了,Bridge 一直欠缺的功能都沒補上!

 

在每篇文章中或文章末加一行”上一篇”、”下一篇” 的導引連結很困難嗎?

 

即使有網友在20152016都有在官方論壇問到這個問題,官方也給出了解法。那為什麼不乾脆一點在後續的版本中把這功能給補足呢?

 

更扯的是官方給的方法還有問題。唉!!

 

我從 1.37版 用到現在的 1.81版還需要自己手動解決這個問題。

 

真的怕以後會忘記,趕緊把過程記下來。

Bridge - 建立"上下篇文章" 連結

問題 不是 問題

根據官方給的方法有三個步驟: (其中第三點是自己補正的)

 
  1. install bridge-child theme

  2. 編輯 bridge\templates\blog_single-loop.php

  3. 佈景外觀–>自訂–>附加的CSS

步驟一 - install bridge-child theme

其實我不知道為何要安裝這個子佈景,既然官方提了就裝吧! 

步驟二 - 編輯 bridge\templates\blog_single-loop.php

於文末加上PHP語法如下: (所有要顯示的格式或顏色都在此設定)

Bridge - 建立"上下篇文章" 連結

<div class=”single_blog_post_navigation”>
<div class=”single_blog_post_prev”>
<?php
$prev_html_info = ”;
if(get_previous_post() != “”){
$prev_post = get_previous_post();
$prev_html_info = get_the_title($prev_post);
}
$prev_html = ‘<font size=”3″ >’.'<i class=”fa fa-angle-double-left”></i>’.’ 上一篇 &nbsp &nbsp &nbsp’.'</font>’.'<font size=”5″ >’.$prev_html_info.'</font>’;
previous_post_link(‘%link’, $prev_html);
?>
</div>
<div class=”single_blog_post_next”>
<?php
$next_html_info = ”;
if(get_next_post() != “”){
$next_post = get_next_post();
$next_html_info = get_the_title($next_post);
}
$next_html = ‘<font size=”5″ >’.$next_html_info.'</font>’.'<font size=”3″ >’.’&nbsp &nbsp &nbsp 下一篇 ‘.'<i class=”fa fa-angle-double-right”></i>’.'</font>’;
next_post_link(‘%link’,$next_html);
?>
</div>
<div class=”clearfix”></div>
</div>

步驟三 - 外觀-->自訂-->附加的CSS

Bridge - 建立"上下篇文章" 連結


.single_blog_post_prev {
float: left !important;
}
.single_blog_post_prev {
display: inline-block !important;
}
.single_blog_post_prev a i {
font-size: 18px !important;
margin-right: 10px !important;
}
.single_blog_post_next {
float: right !important;
}
.single_blog_post_next a i {
font-size: 18px !important;
margin-left: 10px !important;
}
.single_blog_post_navigation {
margin: 20px 0px !important;
}

花了點時間研究,終於完成啦!

Bridge - 建立"上下篇文章" 連結
No Comments

Post A Comment