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:
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