• Resolved rodsazo

    (@rodsazo)


    Hi.

    I’m creating my own theme with custom post types. I have registered them using the following code, but now, the single.php file works only for custom post types (called ‘video’ and ‘agenda’) but not for normal posts. (the permalink to normal posts shows index.php). Anyone know what the problem could be?

    Thank you in advance.

    Here’s the code I use for creating the 2 new post types:

    [Code moderated as per the Forum Rules. Please use the pastebin]

Viewing 1 replies (of 1 total)
  • Thread Starter rodsazo

    (@rodsazo)

    I don’t consider this solved, because the problem persists, but I fixed it by quitting the use of custom permalink structure

    Mine was %category%/%postname%/

    but when I choose some of the default structures, single.php displays properly.

    Searching on the Codex there is a note:

    For performance reasons, it is not a good idea to start your permalink structure with the category, tag, author, or postname fields. The reason is that these are text fields, and using them at the beginning of your permalink structure it takes more time for WordPress to distinguish your Post URLs from Page URLs (which always use the text “page slug” as the URL), and to compensate, WordPress stores a lot of extra information in its database (so much that sites with lots of Pages have experienced difficulties). So, it is best to have at least two path segments in your post’s permalink structure such as /%year%/%postname%/ or even /posts/%postname%/. (Some people recommend /%post_id%/%postname%/ which works for performance reasons but others recommend against it because it is unfriendly to users in the many contexts in which users interact with URLs.) See Otto’s technical writeup on the topic as well as this wp-testers discussion.

    I hope it helps more people

Viewing 1 replies (of 1 total)
  • The topic ‘single.php working for custom post types, but not for normal posts’ is closed to new replies.