QUESTION:

How do I change the appearance of a particular tag?
How do I change the markup used by a particular tag?



ANSWER:

Most tags that display content with markup support some (though not necessarily all) of the following attributes:

  • wraptag – a tag that wraps around content; typically ul by default
  • classCSS class applied to the wraptag; typically uses the tag name by default
  • break – a tag used to wrap or separate each item in a list (of articles, links, etc); typically li by default
  • breakclassCSS class applied to each break tag

It’s not necessary to include < and > in these attributes. If you use the tag names only, Textpattern will handle common self-closing tags correctly. For example:

<txp:section_list wraptag="div" break="br" />

produces something like this, with <br /> tags following each item:

<div class="section_list">
<a href="/section1/">section1</a><br />
<a href="/section2/">section2</a><br />
</div>

While this:

<txp:section_list wraptag="ol" break="li" />

produces <li> tags that surround each item:

<ol class="section_list">
<li><a href="/section1/">section1</a></li>
<li><a href="/section2/">section2</a></li>
</ol>

A detailed list of tags and their supported attributes can be found in the Textpattern Tag Reference. The Attribute Cross Reference lists the tags that support each attribute.