• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Custom Post Type not finding custom template

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Custom Post Type not finding custom template

This topic is: not resolved

Tagged: custom post type template, custom post types

  • This topic has 4 replies, 3 voices, and was last updated 13 years, 4 months ago by HammerHankinson.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • April 16, 2013 at 11:49 am #35787
    HammerHankinson
    Member

    I'm not quite sure I'm going about this the right way but I'm trying to get my custom post type to display the default page template as opposed to the default blog template.

    I've created a Client Directory content type named 'clients' with two taxonomies, State and Practice areas. By default it's displaying the content as a blog post with the blog sidebar and I'm trying to apply my custom client-directory.php template to the CPT so it doesn't look like a blog post but the code I'm using is returning an error.

    Here is the code:

    add_filter( 'template_include', 'clients_template' );
    function clients_template() {
    global $template;
    if( is_post_type_archive( 'clients' ) || is_tax( 'state' ) || is_tax( 'practice areas' ) == get_post_type() )
    $template_file = get_stylesheet_directory_uri() . '/client-directory.php';
    return $template_file;
    }

    And here is the message I get from using this filter:

    "Warning: include(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in /wp-includes/template-loader.php on line 47"

    Is there a better way to do this?

    April 16, 2013 at 4:42 pm #35843
    blogjunkie
    Participant

    Are you familiar with the Template Hierarchy? http://codex.wordpress.org/Template_Hierarchy

    You could simply create a file in your child theme folder named archive-clients.php and put the code for the client directory in there. Remember to end with

    genesis();


    WordPress evangelist, Nike runner, Apple fanboy.
    Work: ClickWP WordPress Support, Play: adventures of a blogjunkie. Talk to me on Twitter @blogjunkie

    April 17, 2013 at 8:10 am #35941
    HammerHankinson
    Member

    Hmm, this is interesting because I did try that with both archive-clients.php and single-clients.php files and the site doesn't recognize them which is why I was trying to use the template_include filter but that's not working either.

    I am using the Custom Post Type UI plugin to create the CPT's, but I wouldn't think that would cause a conflict?

    This is a site that I inherited from a developer that quit in the company I work for, I have no idea what he did but I seriously think he didn't set this site up properly or something because there is other genesis functionality that isn't working correctly.

    April 17, 2013 at 5:19 pm #36023
    essaysnark
    Participant

    Here's what I did to modify how my CPTs are being displayed:

    1) I copied the file single.php from the Genesis core directory, named it single-[cptname].php, and put it in my child theme directory.
    2) To make it look more like a page than a post, I just removed the post_info stuff:

    // Remove the post info function
    remove_action( 'genesis_before_post_content', 'genesis_post_info' );
    

    That's all I've got in the body of the file, and then the standard genesis(); at the bottom. If you want to change the layout so that it's got a different sidebar, you can use the Genesis filters.

    Hope this helps get you pointed in the right direction!

    April 18, 2013 at 7:52 am #36131
    HammerHankinson
    Member

    Yes that does help actually. Thanks!

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble