
An example
Suppose you want the entries in category "Sports" from one blog, the entries tagged "soccer" and "tennis" from another blog and all entries from a third blog (which is about nothing but baseball anyway). All ordered by date and just the ten most recent ones please.It would be nice if you could do <mt:entries blog_ids="1,2,5" categories="1:sports" tags="2:soccer,tennis" lastn="10"> or something similar, but this is not how it works. Does that mean it is impossible? Of course not, this is Movable Type!
The solution
Use an <mt:setvarblock> tag to capture enough entries from all three sources in a hash, where the date/time is the value. Then sort by the value and display the first ten items you get.
<mt:entries blog_ids="1" category="Sports">
<mt:setvarblock name="theentry"><li><mt:entrydate> - <mt:entrytitle></li></mt:setvarblock>
<mt:setvarblock name="entries{$theentry}"><mt:entrydate format="%Y%m%d%H%M%S"></mt:setvarblock>
</mt:entries>
<mt:entries blog_ids="2" tag="soccer OR tennis">
<mt:setvarblock name="theentry"><li><mt:entrydate> - <mt:entrytitle></li></mt:setvarblock>
<mt:setvarblock name="entries{$theentry}"><mt:entrydate format="%Y%m%d%H%M%S"></mt:setvarblock>
</mt:entries>
<mt:setvarblock name="theentry"><li><mt:entrydate> - <mt:entrytitle></li></mt:setvarblock>
<mt:setvarblock name="entries{$theentry}"><mt:entrydate format="%Y%m%d%H%M%S"></mt:setvarblock>
</mt:entries>
<mt:entries blog_ids="2" tag="soccer OR tennis">
<mt:setvarblock name="theentry"><li><mt:entrydate> - <mt:entrytitle></li></mt:setvarblock>
<mt:setvarblock name="entries{$theentry}"><mt:entrydate format="%Y%m%d%H%M%S"></mt:setvarblock>
</mt:entries>
<mt:entries blog_ids="5">
<setvarblock name="theentry"><li><mt:entrydate> - <mt:entrytitle></li></mt:setvarblock>
<mt:setvarblock name="entries{$theentry}"><mt:entrydate format="%Y%m%d%H%M%S"></mt:setvarblock>
</mt:entries>
<ul>
<mt:loop name="entries" sort_by="value numeric reverse">
<mt:if name="__counter__" lt="11"><mt:var name="__key__"></mt:if>
</mt:loop>
</ul>​
<mt:setvarblock name="entries{$theentry}"><mt:entrydate format="%Y%m%d%H%M%S"></mt:setvarblock>
</mt:entries>
<ul>
<mt:loop name="entries" sort_by="value numeric reverse">
<mt:if name="__counter__" lt="11"><mt:var name="__key__"></mt:if>
</mt:loop>
</ul>​
Tweet
Hi,
I came across this post from google looking for some way to sort entry by title.
I know you can use MTEntries sort_by="title" but this modifier prioritizes capitalized letters first to the sort. Im not sure if this is a glitch in the system but this modifier should sort by alphabets used in the title.
Example:
I would like to sort these titles:
-APRICOT
-Aligator
-ABBEY
-Apple
If MTEntries sort_by="title" is used:
-ABBEY
-APRICOT
-Aligator
-Apple
But it really should be
-ABBEY
-Aligator
-Apple
-APRICOT
Would you know how to this?
This was spectacularly useful to me. I'd been giving myself a bit of a headache trying to come up with just this logic. Thank you!
useful to me. I'd been giving myself a bit of a headache trying to come up with just this logic
Thanks for this, took me a while to figure out where to insert everything (which is the main reason I never had a blogroll in the first place, but whatever) but it's working fine now (except that now I need to rebuilt all my old entries.. and unless I do it a few at a time it crashes but that's another problem..)
Thanks for sharing this great tip!
I am facing very stupid problem. I have created a widget 'popular entries' which is being displayed on blog page and blog's categories page. On blog page, it displays 5 entries as expected but on blog's categories page, it just show 1 entry as it seems to be taking context of blog category.
Code is like this,
title -
As the code is common and I have specified multiple blogs as context so why does it show only 1 entry on blog category page. It should show 5 entries there as well.
Am I doing something wrong here?
I totally can't get this to work. For some reason the lt="11" isn't limiting the entries to the last 10 (or any number) at all, and it isn't ordering them by date properly. It's just spitting them out through the loop in the order that they were placed. Any ideas? Thanks.
Nevermind - the reason it won't work is because there's an error in third block of code in the example (which just happened to be the one I grabbed). It's missing the
I used an mt:setvarblock tag in order to capture enough entries from all three sources in a hash, and it works, thank you for your advise
銇傘伨銈娿伀銈傞牷绻併伀銇濄倢銇汉銆呫亴涓夋é冦仹銇伩鎬濊�冧笘é£å±»ä»ºéŠ‡î†¾æµ‰æµœæŽç¶”é¢ ニューバランス 靴 ㄣ仺銉愩儵銉炽å£betweenséŠ‡î‚ ä»±éŠ‡å‹©ä»¸éŠ‡î†¼éƒŠéŠˆå¤ˆä¼„é—╃悊é¨å‹©ä»¾é‘·î„ç¹éŠ‡ã„¥æ‡†é¥å±‚ä¼„æ¶“æ «æ™«éŠ‡î‚¥î”‘éŠ‡å¿‹å€›éŠ‡å—仹銇檚houlds銇Ñ伅銇椼亱銇椼�佺墿浜嬨亴ç戙仾銇忓績銇泦涓ä»éŠ‡ï¸ºäºœéŠˆå¬ªç‰¬éšå ›ä¼€éŠ‡îˆ›æŸŠéŠ‡ç†´ä»¾éŠ‰æ„©å„µéŠ‰ç‚½å£éŠˆæŽ—ä»ˆéŽ´æ„©ä»šéŠˆå¬¨äº¾éŠ‡ã„£ï¿½ä½µä»¢éŠ‡æ¤¼ä»¸éŠˆå ›å€žæ¾¶æ°¥äº¸éŠ‡î†¼ç¸¾é‘·æ’±ä¼€éšæˆ™äº±éŠ‡ï½ƒä»¸é—†å—•è…‘銇椼仧銆�,ニューãƒãƒ©ãƒ³ã‚¹ é´
绉併仧銇°伄绀å¥ç´°éŠ‡î†»è…‘銇уå§éŠ‡î†ºå„›éŠ‰â”¿å…‚銈广仺銇椼仸銇�併仢銈屻亴绉併仧銇°伄鎯戞槦銇Ñäº—éŠˆå¨¿ï¿½ä½µå„ éŠˆÑ儫銉嬨兂銇ㄣ伄銉愩儵銉炽å£éŠ‡æžä¼„é¢é”‹ï¿½Ñ„敮閰嶃亱銈夎嚜é’å—ä¼„éŠˆã„£å„˜éŠ‰î‚ å–
ã‚ã¾ã‚Šã«ã‚‚é »ç¹ã«ãã‚Œã¯äººã€…ãŒä¸‰æ¬¡å…ƒã§ã®ã¿æ€è€ƒä¸–ç•Œã¨ã®ç›¸äº’作用 ニューバランス レディース ã¨ãƒãƒ©ãƒ³ã‚¹betweensã«ã¤ã„ã¦ã®å½¼ã‚‰ã®ç‰©ç†çš„ãªè‡ªå·±ã¨å‘¨å›²ã®ä¸–ç•Œã«è¡Œãよã†ã§ã™shouldsã§ã¯ã—ã‹ã—ã€ç‰©äº‹ãŒå°‘ãªã心ã«é›†ä¸ã—ã¦ã„ã‚‹å ´åˆã«ã¯æ–°ãŸãªãƒãƒ©ãƒ³ã‚¹ã‚’é”æˆã™ã‚‹ã“ã¨ã€ãã—ã¦ã‚ˆã‚Šå¤šãã®å¿ƒè‡“ã«å‘ã‹ã£ã¦é›†ä¸ã—ãŸã€‚
ç§ãŸã¡ã®ç¤¾ä¼šã®ä¸ã§åŠ›ã®ãƒãƒ©ãƒ³ã‚¹ã¨ã—ã¦ã¯ã€ãã‚ŒãŒç§ãŸã¡ã®æƒ‘星ã§ã‚ã‚Šã€ãƒ•ã‚§ãƒŸãƒ‹ãƒ³ã¨ã®ãƒãƒ©ãƒ³ã‚¹ã¸ã®ç”·æ€§æ”¯é…ã‹ã‚‰è‡ªåˆ†ã®ã‚¨ãƒãƒ«ã‚®ãƒ¼ã‚·ãƒ•ãƒˆã®ä¸ã§ã€ç§ãŸã¡ã®ä½“ã®ä¸ã§èµ·ã“ã£ã¦AUSSIæ ¹æœ¬çš„ãªå¤‰åŒ–ãŒã‚ã‚Šã¾ã™ã€‚ã“ã®ã‚·ãƒ•ãƒˆã¯ã€å¿ƒè‡“ã‚’ä¸å¿ƒã¨ã—ãŸå¤šãã§ã‚ã‚‹1〜心ã®ä¸å¿ƒã®å˜åœ¨ã‹ã‚‰ã®ã‚‚ã®ã§ã™ã€‚
最近ã¾ã§ã€ç§ãŸã¡ã¯ã€å¹…ã€é•·ã•ã€é«˜ã•ãªã©ã€ç§ãŸã¡ãŒçŸ¥ã£ã¦
Mentionné dans le système de retraite fran? ais, donnant l'i シャネル バッグ激安 mpression que le parti au pouvoir a osé remuer un nid de frelons comme le courage, malgré les difficultés. 14 juin,シャãƒãƒ« ãƒãƒƒã‚°æ¿€å®‰, le Comité spécial chargé d'élaborer le système de retraite Xi Moluo (Yannick Moreau) Mme Hérault a présenté un ra
Too frequently it appears many people continue ones own planets thinkin chanel 財布 g about primarily with the last measurements additionally, the sociallizing and even account balance around ones own external selves additionally, the neighboring universe. Though an alternative account balance should really be
I'm sure penning to work with for ones standing for being an English tong Apple MacBook Pro MC374LL/A 13.3-Inch Laptop ue music teacher for which you just presented through Sichuan Day to day. I Cheap Apple iPad 2 64GB just take on inclined need for typically the put up considering that I just discover your leading not to mention things most certainly fulfill the desi
additionally progress on the earth Changhong E22M750DV 21.5 inch 54cm Full HD Edge Lit LED / LCD Combo . Comprehensive industrialization,Changhong Apple iMac MB418LL/A 24-Inch Desktop E22M750DV 21.5 inch 54cm Full HD Edge Lit LED / LCD Combo, that's ignited each of the advantage in addition to establishments most of us delight in currently, has become based on the detailed exploitation on the earth’s he
adidas squash footwear squash footwear adidas Custom NFL Jerseys adidas s
Adidas is probably the top rated sporting producers from the world and so they make a huge selection of equipment and clothing together with an amazing choice of squash sneakers. Among the list of places which have prolonged viewed Adidas in fr