wordpress 擷取上一篇 下一篇文章參數

來源:互聯網
上載者:User

擷取上一篇:previous_post_link(),擷取下一篇:next_post_link()

參數:
1、當前文章同一分類下的上下文章
2、上下一篇文章標題、連結、特色映像

如果只是參數1,官方有樣本:

不知道有沒有什麼方式擷取參數2的要求。


是要得效果,那兩個縮圖是WordPress上/下篇文章的特色映像,the_post_thumbnail();調用的 ,下面的標題和連結是上面的代碼調用的,特色映像是手動調的,我想要自動調用上/下篇文章的特色映像和連結地址

回複內容:

擷取上一篇:previous_post_link(),擷取下一篇:next_post_link()

參數:
1、當前文章同一分類下的上下文章
2、上下一篇文章標題、連結、特色映像

如果只是參數1,官方有樣本:

不知道有沒有什麼方式擷取參數2的要求。


是要得效果,那兩個縮圖是WordPress上/下篇文章的特色映像,the_post_thumbnail();調用的 ,下面的標題和連結是上面的代碼調用的,特色映像是手動調的,我想要自動調用上/下篇文章的特色映像和連結地址

ID ); ?>">ID, '', '' ); ?>上一篇: ID ); ?>">post_title; ?>ID ); ?>">ID, '', '' ); ?>上一篇: ID ); ?>">post_title; ?>

好人做到底.
自己看著修改吧.

function nav_link_with_thumb(){         $output = '';         $prev_post = get_previous_post();         if ($prev_post){          $output .= get_the_post_thumbnail($prev_post->ID, 'thumbnail');             $prev_post->filter='sample';             $output .= 'Previous Post: '.$prev_post->post_title.'';         }         $next_post = get_next_post();         if ($next_post){             $output .= get_the_post_thumbnail($next_post->ID, 'thumbnail');             $next_post->filter='sample';             $output .= 'Next post: '.$next_post->post_title.'';         }         echo $output;}

能支援下tab嗎?

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.