StartAdministrationPlugin Last Modified Posts Shortcode

Plugin Last Modified Posts Shortcode

-

Shortcode “Last modified Posts”:

fully configurable, use as

(last-modified-posts-shortcode number=20)
[*last-modified-posts  number=20 …. … …] 

options to use (here you see the default values)

OPTION

DEFAULT VALUE

number

 10

query

  “”

order

  “DESC”

orderby

 “modified”

lmstart

 “<div >”

lmend

 “</div>”

title

 “”

textbeforelist

 “”

textbeforeitem

 “”

liststart

 “<ul>”

listend

 “</ul>”

itemstart

 “<li>”

itemend

 “</li>”

showdate

 “true”

spandate

 “<span >”

dateformat

“j. M Y  H:i”

textbeforedate

” | “

textafterdate

“”

 

Explanation of Options

       

query = “”

use whatever query you want, e.g. query=”cat=2,6,17,28″ to show all posts with category 28. For further query-information please visit: WP-Codex Queries

If in addition the the option “orderby” is set to “none” you get an shortcode that does not show modified post-list but what-ever list you want to show. As the shortcode has its own wp_query build in it works in all places / templates, also in TEXT-WIDGEDS, beside is my frontpage footer widget shown using this shortcode

number = 10

number of posts shown in this list

 

order =  “DESC”   

orderby = “modified”

see WP-Codex: Orderby to use plugin more generic, not just as “modified-pages” shotcode

 

lmstart = “<div class=lastmod>”

lmend = “</div>”

used as first html-tag around the shortcode.

 title =  “”

use html-style text, e.g. title=”<h3>Last modifed posts</h3>”

textbeforelist = “”

use html-style text that is shown under the title before the list

liststart = “<ul>”
listend = “</ul>”

use this html-tags to set the ul-list-style, e.g. liststart=”<ul class=iconarrow>”

itemstart = “<li>”
itemend = “</li>”

use this hatml-tags to set the list-style

textbeforeitem = “”

this option is missleading, the list is formated like    <li> textbeforeitem  <a href=”xxxxx”> some post title </a> </li>, so this option sets some text or html-code right befor the post-title.

showdate = “true”  

show the date of the post

spandate = “<span id=lastmod>”

the date of the post is html-tagged via <span> Postdate </span>. If you re-define this option and clear it by spandate=”” no span-tagging is performed for date

dateformat = “j. M Y  H:i”    

use the wordpress dateformat as shown in Codex

textbeforedate = ” | “

textafterdate = “”  

these texts are used for calling the get_modified_date() function in WordPress, see Codex

 

 

here the query-line

$q=’posts_per_page=’ . $number . ‘&orderby=’. $orderby . ‘&order=’ . $order;
if ($query<>””)
  $q= $query . “&” . $q;
// The Query
$the_query = new WP_Query( $q );

 

the only weekness I see is that I use “get_modified_date()”, this should be more generic as option so that you also can get result of the_time(). If anyone has demand on that pleas feel free to request.

 

suggestions & improvements are welcomed,  Aug/2011 Heli Retzek

 

[download_box]download the plugin:  last-modified-posts-shortcode[/download_box] [divider]

Kommentieren Sie den Artikel

Bitte geben Sie Ihren Kommentar ein!
Bitte geben Sie hier Ihren Namen ein

×