WordPress.org

Ready to get started?Download WordPress

Forums

Types - Custom Fields and Custom Post Types Management
[resolved] Custom archive page not used (4 posts)

  1. alhemicar
    Member
    Posted 1 year ago #

    Thanks for the great plugin, real time-saver!

    I have a "small" problem - the single.php page for displaying my custom post types is working great, but the archive.php does not. My post type is named "deal", custom taxonomy is "deal_type", the two template pages are named like

    single-deal.php
    archive-deal.php

    When I try to show all posts from the custom taxonomy, WP defaults to archive.php. Now, all of the settings in Types are set correctly, has_archive is checked, rewrite is checked, I even checked into the WP database and this field is set to "yes", but in the frontend WP does not use archive-deal.php.

    Any idea why this is happening and what could be the solution? By the way, I tried other plugin for custom post types and its archive page is used correctly with the custom post type I created there.

    Many thanks,
    Robert Stojkov

  2. AmirHelzer
    Member
    Plugin Author

    Posted 1 year ago #

    Any chance that your theme runs before the WordPress init hook? Types runs as a plugin, so if the theme does things BEFORE Types, the custom post types will not be registered on time.

    Do you want to try this with the default WP theme? The 2011 theme loads everything in the right sequence. If the archive pages don't show there too, we'll need to check Types and see if it might be doing anything in the wrong timing.

  3. alhemicar
    Member
    Posted 1 year ago #

    Thanks for looking into this, but it turned out that nothing is wrong with Types - the archive-deal.php correctly shows ALL of the custom posts, regardless of the categories I added into my custom taxonomy deal_type; all I had to do is to create a new taxonomy template taxonomy-deal_type.php and use some loop code inside to get what I want from each post under the specific taxonomy entry. I followed this article, http://mondaybynoon.com/20100906/wordpress-archive-pages-taxonomy/

    Thanks again, really like the power and simplicity of Types, especially its built-in support for custom fields.

    Now I'm facing different challenge, and that is how to get the correct permalinks for the custom post, which with Types looks like

    http://mysite.com/post_type/post_title

    while it should follow the taxonomy hierarchy like

    http://mysite.com/post_type/taxonomy_category_1/taxonomy_category_2/post_title

    Cheers,
    Robert

  4. AmirHelzer
    Member
    Plugin Author

    Posted 1 year ago #

    Great. I'm marking this thread as resolved.

    Types doesn't generate the WordPress rewrite rules. There's a field, in the custom post type edit, which lets you enter the URL, but Types doesn't do much with it. It only passes that string to WordPress.

    I recommend that you lookup in the WordPress codex, to learn the syntax of the permalink structure. Personally, I never touch this. I leave it as the WordPress default.

    Since we run sites with tons of content and in different languages, we prefer to keep to the standard and default permalink rules.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic