• Great plugin!
    Hope you will consider updating this to work with child themes since that is recommended way to customize themes.

    I modified the plugin to do this, but will have to again with each plugin update. Also not sure this method will work with older versions of WordPress since wp_get_theme() was added in 4.3

    In the plugin file wp-custom-post-template.php I modified the function wp_get_post_custom_templates() to use the active (in my case a child) theme directory when looking for templates instead of the base/parent:

    Comment out line 90:
    //$theme = get_option( 'template' );

    And add:
    $theme = wp_get_theme()->get( 'TextDomain' );

    Appreciate the plugin, used it to make a custom template for this article to not have a sidebar.

    https://www.ads-software.com/plugins/wp-custom-post-template/

Viewing 6 replies - 1 through 6 (of 6 total)
  • I too would like to see support for this built into the plugin since I don’t want to have have the parent theme in my source control

    Another thought to editing the plugin is to create a grunt or gulp task that copies the template files up to the parent directory:

    watch: {
                php: {
                    files: 'post-templates/*.php',
                    tasks: ['sync']
                }
    }
    
    sync: {
                copy_resources: {
                    files: [
                        { cwd: 'post-templates', src: '*.php', dest: '../Origin' },
                    ]
                }
            }
    }

    For me this help. I changed 'template' to 'stylesheet' in line 90. And now works both for parent and child theme.

    Thanks computerinfo21 and Artus2000! Exactly what I was looking for.
    Would be a really nice (and simple, it seems) addition to this already-good plugin.

    Artus2000’s solution worked for me. I’ve also been trying to get this to work. Thanks!

    i tried both

    1. template -> stylesheet
    2. $theme = get_option( ‘template’ ); -> $theme = wp_get_theme()->get( ‘TextDomain’ );

    but i still get no select box on my posts. I am getting the area “WP Post Template” but there is no select box.

    What i am doing wrong? Ideas?

    Thank you computerinfo21, that hack worked perfectly.

    This plugin is exactly what I need to add post style flexibility to my child theme. But I don’t like hacking plugins in case they get updated…has anyone found a similar plugin that is being maintained?

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Update to work with child theme’ is closed to new replies.