6.16 カテゴリ一覧にブログ記事タイトルを表示する ★
P.468
カテゴリ一覧にブログ記事タイトルをすべて表示する
「カテゴリアーカイブ」ウィジェットテンプレート(サンプルテンプレート)
<mt:ifArchiveTypeEnabled archive_type="Category">
<mt:if tag="blogCategoryCount">
<dt class="sidetitle">カテゴリ一覧</dt>
<dd class="side">
<mt:topLevelCategories>
<mt:subCatIsFirst><ul></mt:subCatIsFirst>
<mt:if tag="categoryCount">
<li><a href="<mt:categoryArchiveLink />" title="<mt:categoryDescription />"><mt:categoryLabel></a> [<mt:categoryCount />]
<mt:entries>
<mt:entriesHeader>
<ul class="tree">
</mt:entriesHeader>
<li class="tree-list<mt:entriesFooter> tree-list-end</mt:entriesFooter>"><a href="<mt:entryPermalink valid_html="1" />" title="<mt:entryTitle encode_html="1" />"><mt:entryTitle encode_html="1" /></a></li>
<mt:entriesFooter>
</ul>
</mt:entriesFooter>
</mt:entries>
<mt:else>
<li><mt:categoryLabel>
</mt:if>
<mt:subCatsRecurse />
</li>
<mt:subCatIsLast></ul></mt:subCatIsLast>
</mt:topLevelCategories>
</dd>
</mt:if>
</mt:ifArchiveTypeEnabled>
P.469
...前略...
<dd class="side" id="categories">
...後略...
★「カテゴリアーカイブ」ウィジェットテンプレート(デフォルトテンプレート)
元のテンプレートに011~019を追加しています。処理の流れはサンプルテンプレートと同じですが、013のul要素のclass属性値は、widget-listに加えてツリー化用のtree、015にもツリー化用のtree-listと、最後のli要素にtree-list-endを出力するためのentriesFooterタグを追加します。
001:<mt:IfArchiveTypeEnabled archive_type="Category">
002:<div class="widget-archive widget-archive-category widget">
003: <h3 class="widget-header">カテゴリ</h3>
004: <div class="widget-content">
005: <mt:TopLevelCategories>
006: <mt:SubCatIsFirst>
007: <ul class="widget-list">
008: </mt:SubCatIsFirst>
009: <mt:IfNonZero tag="mt:CategoryCount">
010: <li class="widget-list-item"><a href="<$mt:CategoryArchiveLink$>"<mt:IfNonEmpty tag="mt:CategoryDescription"> title="<$mt:CategoryDescription$>"</mt:IfNonEmpty>><$mt:CategoryLabel$> (<$mt:CategoryCount$>)</a>
011: <mt:entries>
012: <mt:entriesHeader>
013: <ul class="widget-list tree">
014: </mt:entriesHeader>
015: <li class="tree-list<mt:entriesFooter> tree-list-end</mt:entriesFooter>"><a href="<mt:entryPermalink valid_html="1" />" title="<mt:entryTitle encode_html="1" />"><mt:entryTitle encode_html="1" /></a></li>
016: <mt:entriesFooter>
017: </ul>
018: </mt:entriesFooter>
019: </mt:entries>
020: <mt:Else>
021: <li class="widget-list-item"><$mt:CategoryLabel$>
022: </mt:IfNonZero>
023: <$mt:SubCatsRecurse$>
024: </li>
025: <mt:SubCatIsLast>
026: </ul>
027: </mt:SubCatIsLast>
028: </mt:TopLevelCategories>
029: </div>
030:</div>
031:</mt:IfArchiveTypeEnabled>
カテゴリ一覧に、該当カテゴリのブログ記事タイトルだけを表示する
「カテゴリアーカイブ」ウィジェットテンプレート(サンプルテンプレート)
<mt:ifArchiveTypeEnabled archive_type="Category">
<mt:if tag="blogCategoryCount">
<mt:if name="category_archive">
<mt:categoryLabel setvar="category_name" />
</mt:if>
<dt class="sidetitle">カテゴリ一覧</dt>
<dd class="side">
<mt:topLevelCategories>
<mt:subCatIsFirst><ul></mt:subCatIsFirst>
<mt:if tag="categoryCount">
<li><a href="<mt:categoryArchiveLink />" title="<mt:categoryDescription />"><mt:categoryLabel></a> [<mt:categoryCount />]
<mt:categoryLabel setvar="current_category_name">
<mt:if name="current_category_name" eq="$category_name">
<mt:entries>
<mt:entriesHeader>
<ul class="tree">
</mt:entriesHeader>
<li class="widget-list-item tree-list<mt:entriesFooter> tree-list-end</mt:entriesFooter>"><a href="<mt:entryPermalink valid_html="1" />" title="<mt:entryTitle encode_html="1" />"><mt:entryTitle encode_html="1" /></a></li>
<mt:entriesFooter>
</ul>
</mt:entriesFooter>
</mt:entries>
</mt:if>
<mt:else>
<li><mt:categoryLabel>
</mt:if>
<mt:subCatsRecurse />
</li>
<mt:subCatIsLast></ul></mt:subCatIsLast>
</mt:topLevelCategories>
</dd>
</mt:if>
</mt:ifArchiveTypeEnabled>
P.470
「カテゴリアーカイブ」ウィジェットテンプレート
...前略...
<dd class="side" id="categories">
...後略...
★「カテゴリアーカイブ」ウィジェットテンプレート(デフォルトテンプレート)
元のテンプレートに002~004と、014~025を追加しています。
001:<mt:IfArchiveTypeEnabled archive_type="Category">
002:<mt:if name="category_archive">
003: <mt:categoryLabel setvar="category_name" />
004:</mt:if>
005:<div class="widget-archive widget-archive-category widget">
006: <h3 class="widget-header">カテゴリ</h3>
007: <div class="widget-content">
008: <mt:TopLevelCategories>
009: <mt:SubCatIsFirst>
010: <ul class="widget-list">
011: </mt:SubCatIsFirst>
012: <mt:IfNonZero tag="mt:CategoryCount">
013: <li class="widget-list-item"><a href="<$mt:CategoryArchiveLink$>"<mt:IfNonEmpty tag="mt:CategoryDescription"> title="<$mt:CategoryDescription$>"</mt:IfNonEmpty>><$mt:CategoryLabel$> (<$mt:CategoryCount$>)</a>
014: <mt:categoryLabel setvar="current_category_name">
015: <mt:if name="current_category_name" eq="$category_name">
016: <mt:entries>
017: <mt:entriesHeader>
018: <ul class="widget-list tree">
019: </mt:entriesHeader>
020: <li class="widget-list-item tree-list<mt:entriesFooter> tree-list-end</mt:entriesFooter>"><a href="<mt:entryPermalink valid_html="1" />" title="<mt:entryTitle encode_html="1" />"><mt:entryTitle encode_html="1" /></a></li>
021: <mt:entriesFooter>
022: </ul>
023: </mt:entriesFooter>
024: </mt:entries>
025: </mt:if>
026: <mt:Else>
027: <li class="widget-list-item"><$mt:CategoryLabel$>
028: </mt:IfNonZero>
029: <$mt:SubCatsRecurse$>
030: </li>
031: <mt:SubCatIsLast>
032: </ul>
033: </mt:SubCatIsLast>
034: </mt:TopLevelCategories>
035: </div>
036:</div>
037:</mt:IfArchiveTypeEnabled>