Utilizar diferentes plantillas de páginas en función de la carpeta, de un tag, o de un campo personalizado

Movable type Sin comentarios »

Solución aportada en el wiki de movable type

Here’s a solution to use a different page template based upon the “Folder” each page is in.

  1. Copy the contents of the Page archive template into a template module called “Default Page”.
  2. Create additional template modules for each page template as necessary: News Page, Industry Page, Product/Service Page etc. (assuming that the same page template is used for Product and Service pages in this example)
  3. Create a folder corresponding to each Page template: News, Industry, Products, Services, etc.
  4. Update the Page archive template to use the following code:
    <mt:setvarblock name="page_folder"><mt:PageFolder><$mt:FolderLabel$></mt:PageFolder></mt:setvarblock>
    <mt:if name="page_folder" eq="News">
       <$mt:include module="News Page"$>
    <mt:else name="page_folder" eq="Industry">
       <$mt:include module="Industry Page"$>
    <mt:else name="page_folder" like="(Products|Services)">
       <$mt:include module="Products/Services Page"$>
    <mt:else>
       <$mt:include module="Default Page"$>
    </mt:if>
  5. Publish and View

Continuar leyendo »

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Iniciar sesión