內容簡介
此外掛會提供一個短碼,讓您可以選擇特定類別或文章類型並顯示最新的文章。您可以選擇要顯示多少篇文章以及要從文章中獲取哪些資訊。
引數:
id – 您可以透過逗號分隔的文章類別 ID 來使用
num – 每個文章類別要返回的文章數量
info – 印出的所有資訊都在這裡
列印資訊的引數:
thumb: 返回文章的特色圖片,您必須在 ‘:’ 後面指定縮圖的寬度,並且會有一個連結至文章的連結
title: 返回標題,並且會有一個連結至文章的連結
excerpt: 返回文章的前幾行,您可以指定文字的長度以及副標題。excerpt:LENGTH:SUB-TEXT,且會有一個連結至文章的連結
content: 返回文章的所有內容
date: 返回文章的發佈日期,您可以在 ‘:’ 後面指定格式
更多有關日期的訊息:
日期格式使用 PHP 的預設格式符號,以下是其中一些格式範例:
d:月份的第幾天
m:月份
y:年份
它有一些限制,例如您無法使用跳脫字元(目前不支援)。
查看完整列表請參閱手冊:http://php.net/manual/en/function.date.php
一些範例:
[os_lastpost id=”x,y,z” num=2 info=”title,date:d/m/y,thumb:130,excerpt:120: … veja mais”]
返回來自文章類別 x、y 和 z 的最新兩篇文章。設定日期格式為 Day/Month/Year,並使用寬度為 130 像素的特色圖片。從文章內容中選取 120 個字符並將 a 轉為省略號。並推出 “… 閱讀更多” 的自訂文字。
[os_lastpost post_type=”custom_post_type” num=5 info=”title,excerpt”]
返回最新的五篇自訂文章類型文章,並且印出標題以及文章內容的前 60 個字符。並推出預設文字 “... 繼續閱讀”。
[os_lastpost post_type=”post” num=5 info=”title,content”]
返回所有文章類別中最新的五篇文章,並印出文章標題以及內容的全部文本。
其他內容
外掛標籤
開發者團隊
📦 歷史版本下載
原文外掛簡介
Veja descrição em portugues em: http://onespace.com.br/lastpost/
This plugin provides you with a shortcode that returns the latest posts from specifics categories or post_types, you can choose how many posts is to be show or what kind of information you can get from posts.
Arguments:
id – You can use any number of post categories ids separeted by commas
num – the number of posts to return for wich categorie id
info – this is where goes all the printing information
Info printing arguments:
thumb: returns the post’s featured image, you must specify the width of the thumb after ‘:’, has a link to the post
title: returns the title, has a link to the post
excerpt: returns the first lines from you post you can specify the lenght of the text to show and a subtext. excerpt:LENGTH:SUB-TEXT, has a link to the post
content: returns all content from post
date: returns date of post publishing, you can specify the format after ‘:’
More about date:
Date format uses php default formating symbols, here goes some of then;
d: day of month
m: month
y: year
it has some limitations, you can’t use escape chars (yet).
check the manual to see the complete list: http://php.net/manual/en/function.date.php
A few examples:
[os_lastpost id=”x,y,z” num=2 info=”title,date:d/m/y,thumb:130,excerpt:120: … veja mais”]
returns the latest 2 posts from post categories x, y and z, printing the date on Day/Month/Year, featured image 130 px of width, 120 chars from post content (html stripped) and a custom text ” … veja mais” at the end.
[os_lastpost post_type=”custom_post_type” num=5 info=”title,excerpt”]
returns the latest 5 posts from a custom post type, printing title, and the first 60 chars from the post content and a default text ” … read more”
[os_lastpost post_type=”post” num=5 info=”title,content”]
returns the latest 5 posts from all your categories, printing title, and full content
Arbitrary section
