ThemeShaper Forums » Thematic

[closed]

Custom page templates for displaying specific posts

(7 posts)
  • Started 2 years ago by Victorius
  • Latest reply from Victorius
  • This topic is resolved
  1. Hi! I am new in WP, and for my first theme I am using custom post types (CPTs) and taxanomies. (my CPTs are “talleres” and “cursos”)

    They are working fine but I have doubts about how I should organize and display their posts. I would like to know the best practices in these cases. (In addition, I am using WP custom menu to organize my menu with the different pages and CPTs)

    I have tried two ways of displaying the post:

    OPTION 1: Using WP template hierarchy. In WP custom menu I add a custom link with the URL of the CPT and the corresponding label. This way, WP will look for the file archive-{post-type-slug}.php, and if it doesn´t exists WP will get archive.php. ( I have modified a copy of archive.php in my child theme to show the descriptions of taxonomies and CPTs to make a small presentation before displaying the posts)

    OPTION 2: Using custom page templates. Thematic includes some templates like “blog” that I could modify to display specific posts. But what I am trying to do is to get the content of the page (a presentation for the posts that are going to be displayed below), and after that content, display the loop of the CPT. You can see the code of my template page template-talleres.php here:

    http://pastebin.com/TWQE5Uyw

    And here is the link of the page that uses the template page:

    http://www.vicdilu.com/pruebas/meditaya/talleres/

    (I am focusing on the funcionalities, and I haven´t worked much on the style of the web)

    What I did is to copy and rename archives.php template page. After the content, instead of using thematic_archives() I used the thematic_archive_loop() of archive.php with the query for the CPT.

    I prefer OPTION 2, however I don´t know if this is an appropiate way to work with CPTs.

    On the other hand, I am also using page templates to display entries of different categories (for example, “profesores” or “noticias”). They display the content as expected, but somehow, they are not recognized as subpages: I am using a plugin to display subpages of the current pages, and if I use these page templates they are not shown in the list of subpages. I have also tried with wp_nav_menu and these pages are not recognized as current_page_item. You can see how subpages is not working in this examples:

    http://www.vicdilu.com/pruebas/meditaya/recursos/

    http://www.vicdilu.com/pruebas/meditaya/recursos/noticias/

    I don´t know where the problem could be? Any idea or suggestion?

    I have also tried to use wp_query or get_posts to do the loop in the template page, but the problem remains. I would appreciate any help.

    Thanks in advance,
    Víctor

    Posted 2 years ago #
  2. option 1 uses default WP behavior. why use a page template?

    Posted 2 years ago #
  3. Hi Helga!

    Thanks for yor prompt reply! your support is very helpful!

    I thought page templates could be a good idea for two reasons:

    1) It would be easier for my clients to change the content displayed before the posts ( for taxonomies it´s easy, but for CPTs the description is in the register_post_type())

    2) I was planning to list the subpages with a plugin or with wp_list_pages, and using Option 1, these page are not recognized as pages or child pages.

    Anyway, I followed your advice. I have changed all the "archives pages" in the custom menu to use WP hierarchy. To list the pages (and subpages) I am using Gecka Submenu plugin (that lists subpages from the custom menu) and now everything is working as expected.

    Thanks again,
    Víctor

    Posted 2 years ago #
  4. 1) It would be easier for my clients to change the content displayed before the posts ( for taxonomies it´s easy, but for CPTs the description is in the register_post_type())

    that is true. you can make an options page for the CPT, i'm working on that in my upcoming (ie upcoming some day) portfolio plugin. you can also change the slugs w/ the same approach.

    Posted 2 years ago #
  5. Hi! That´s a good idea! Theme options are beyond my current knowledge at the moment. Fortunately there´s plenty of material about that topic in the web, and with enough patience I think I will be able to work it out.

    I would be interested to try the plugin you´re working on, once it´s released.

    Thanks again for your support,
    Best regards
    Victor

    Posted 2 years ago #
  6. if it is anything like my portfolio website it might never be done. :) but in the mean time, i prefer to handle theme options with devin price's killer options framework plugin

    http://wptheming.com/options-framework-plugin/

    Posted 2 years ago #
  7. Hi! That plugin looks great! It will save me a lot of time (and headache)

    Good luck on your plugin! (and your portfolio)

    Posted 2 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.