New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't set page template for custom post type (page)? #111

Closed
Brenderous opened this Issue Feb 10, 2012 · 12 comments

Comments

Projects
None yet
8 participants
@Brenderous

Brenderous commented Feb 10, 2012

Are we no longer able to set the Page Template for custom post types, even if their "Capability type" is set to "page"?

What's the deal?

@fabiodexter

This comment has been minimized.

Show comment
Hide comment
@fabiodexter

fabiodexter Feb 13, 2012

same problem, here.

fabiodexter commented Feb 13, 2012

same problem, here.

@imjp

This comment has been minimized.

Show comment
Hide comment
@imjp

imjp Mar 7, 2012

I'm wondering the same thing. I really need the page template..

imjp commented Mar 7, 2012

I'm wondering the same thing. I really need the page template..

@gabor-udvari

This comment has been minimized.

Show comment
Hide comment
@gabor-udvari

gabor-udvari Mar 7, 2012

Contributor

Do you mean something like: single-customtype.php and archive-customtype.php templates in your theme? Those should work with the recent github version, I checked it.

Contributor

gabor-udvari commented Mar 7, 2012

Do you mean something like: single-customtype.php and archive-customtype.php templates in your theme? Those should work with the recent github version, I checked it.

@kobobo

This comment has been minimized.

Show comment
Hide comment
@kobobo

kobobo Mar 7, 2012

Yes it works fine!

kobobo commented Mar 7, 2012

Yes it works fine!

@gabor-udvari

This comment has been minimized.

Show comment
Hide comment
@gabor-udvari

gabor-udvari Apr 8, 2012

Contributor

I was wrong, the bug is that if you edit a page, there's a box where you can select the template, but there's no such thing with a custom post type. I'll look into this.

Contributor

gabor-udvari commented Apr 8, 2012

I was wrong, the bug is that if you edit a page, there's a box where you can select the template, but there's no such thing with a custom post type. I'll look into this.

@gabor-udvari

This comment has been minimized.

Show comment
Hide comment
@gabor-udvari

gabor-udvari Apr 8, 2012

Contributor

This is a Wordpress limitation (bug). The function which displays the page attributes metabox checks the post_type, not the capability_type, see wp-admin/includes/meta-boxes.php line 583:

<?php
if ( 'page' == $post->post_type && 0 != count( get_page_templates() ) ) {
                $template = !empty($post->page_template) ? $post->page_template : false;
                ?>
<p><strong><?php _e('Template') ?></strong></p>
<label class="screen-reader-text" for="page_template"><?php _e('Page Template') ?></label><select name="page_template" id="page_template">
<option value='default'><?php _e('Default Template'); ?></option>
<?php page_template_dropdown($template); ?>
</select>
<?php
        } ?>

It would be nice if this would be fixed in the Wordpress core, but it will be faster if we workaround this.

Contributor

gabor-udvari commented Apr 8, 2012

This is a Wordpress limitation (bug). The function which displays the page attributes metabox checks the post_type, not the capability_type, see wp-admin/includes/meta-boxes.php line 583:

<?php
if ( 'page' == $post->post_type && 0 != count( get_page_templates() ) ) {
                $template = !empty($post->page_template) ? $post->page_template : false;
                ?>
<p><strong><?php _e('Template') ?></strong></p>
<label class="screen-reader-text" for="page_template"><?php _e('Page Template') ?></label><select name="page_template" id="page_template">
<option value='default'><?php _e('Default Template'); ?></option>
<?php page_template_dropdown($template); ?>
</select>
<?php
        } ?>

It would be nice if this would be fixed in the Wordpress core, but it will be faster if we workaround this.

@gnuget

This comment has been minimized.

Show comment
Hide comment
@gnuget

gnuget Apr 10, 2012

Member

I discussed with Edgar about this a few months ago and one option was giving back the "write panels engine" from MF1.

The write panels was the way to we simulate the "post types" when wordpress did not was ready for manage the post type for him self. So restoring the Write panels engine means: Adding code for do almost the same to the post types, this is not DRY and eventually will be more hard maintain the code.

For that we delayed the reimplementation of this feature until we figure out a better way to workaround this problem.

Would great to use this issue for discuss possible solutions for this problem, just taking in account to the write panels is not a option

Member

gnuget commented Apr 10, 2012

I discussed with Edgar about this a few months ago and one option was giving back the "write panels engine" from MF1.

The write panels was the way to we simulate the "post types" when wordpress did not was ready for manage the post type for him self. So restoring the Write panels engine means: Adding code for do almost the same to the post types, this is not DRY and eventually will be more hard maintain the code.

For that we delayed the reimplementation of this feature until we figure out a better way to workaround this problem.

Would great to use this issue for discuss possible solutions for this problem, just taking in account to the write panels is not a option

@gnuget

This comment has been minimized.

Show comment
Hide comment
@gnuget

gnuget Jul 6, 2012

Member

Btw i think to i know how workaround this

I'm going to do a couple test before make a push.

Member

gnuget commented Jul 6, 2012

Btw i think to i know how workaround this

I'm going to do a couple test before make a push.

@gnuget gnuget closed this in d5e6b22 Jul 7, 2012

@gnuget

This comment has been minimized.

Show comment
Hide comment
@gnuget

gnuget Jul 7, 2012

Member

Would be awesome if someone of you help us to test this. :-)

Member

gnuget commented Jul 7, 2012

Would be awesome if someone of you help us to test this. :-)

@elbego

This comment has been minimized.

Show comment
Hide comment
@elbego

elbego Sep 20, 2012

Hi - have installed and tested - once publish is clicked it reverts back to default template?

elbego commented Sep 20, 2012

Hi - have installed and tested - once publish is clicked it reverts back to default template?

@inkbeard

This comment has been minimized.

Show comment
Hide comment
@inkbeard

inkbeard Sep 24, 2012

Hey guys, I'm having the same problem. i have a put the code in the 3 files, but when I update or publish, the file automatically reverts back to the Default Template. Is there any additional steps I can try to help out? Thanks for all the hard work.

inkbeard commented Sep 24, 2012

Hey guys, I'm having the same problem. i have a put the code in the 3 files, but when I update or publish, the file automatically reverts back to the Default Template. Is there any additional steps I can try to help out? Thanks for all the hard work.

@gnuget

This comment has been minimized.

Show comment
Hide comment
@gnuget

gnuget Dec 7, 2012

Member

no, there is not additional step.

Can you provide more info?

which wordpress version.
Browser.
There is another plugin active?

EDIT I just test it again and all seems to work fine, if this is not working for someone i will need more info, (the name of the post type, if has some custom fields etc)

Member

gnuget commented Dec 7, 2012

no, there is not additional step.

Can you provide more info?

which wordpress version.
Browser.
There is another plugin active?

EDIT I just test it again and all seems to work fine, if this is not working for someone i will need more info, (the name of the post type, if has some custom fields etc)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment