google-code-export / wordpress-custom-content-type-manager

Automatically exported from code.google.com/p/wordpress-custom-content-type-manager
2 stars 1 forks source link

Is there conflict between get_post_format() and custom post types #461

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem? (Be specific enough so that someone
else can make the plugin fail for themselves. Remember: if the issue can't
be fixed if it can't be reproduced!)
1. Clean Wordpress installation on XAMPP. With default Twenty Eleven theme.
2. Install and activate CCTM - latest version.
3. Create one custom post type "mebeli" - this meaning furniture.
4. Create category "Kitchen" for those post types.
5. Add new post type "mebeli" and post it in category "Kitchen".
6. Put link to "Kitchen" in top navigation.
7. Add files content-mebeli.php and single-mebeli.php in theme folder.

What is the expected output? What do you see instead?

I expect after click on category Kitchen, WP to load content-mebeli.php.
But it loads content.php.

is this "get_post_format()" doesn't work with custom post types or there is bug 
in CCTM.  

I'll attach exported custom post types that I made if some one want to test 
with them. They are exported from CCTM tools.

Does the problem continue if you disable all other plugins? (Conflicts
between plugins are easily the #1 cause of errors, so it's important to
isolate the issue):

There is no other active plugins.

Please copy and paste the system information that appears in a yellow
textarea when you click on "Report a Bug" on any CCTM admin screen (this
includes the version of the
plugin, the version of PHP, the version of MySQL, a list of other active
plugins etc.):

*SYSTEM INFO* 
------------------------ 
Plugin Version: 0.9.6.7-pl
WordPress Version: 3.5.1
PHP Version: 5.3.5
MySQL Version: 5.5.8
Server OS: WINNT
------------------------ 
ACTIVE PLUGINS: 
------------------------ 
CURRENT THEME: Twenty Eleven v.1.5 
http://wordpress.org/extend/themes/twentyeleven

Thank You in advice!
Best Regards

Original issue reported on code.google.com by bogastyl...@gmail.com on 18 Feb 2013 at 8:26

Attachments:

GoogleCodeExporter commented 9 years ago
Are you sure content-mebeli.php is the theme file that's supposed to load?  The 
way WP handled templates is crazy and very difficult to troubleshoot.  Are you 
sure it's not supposed to be category-mebeli.php?

See http://codex.wordpress.org/Template_Hierarchy

Original comment by ever...@fireproofsocks.com on 18 Feb 2013 at 8:50

GoogleCodeExporter commented 9 years ago
Hi,

And thanks for fast replay.

I'm not experienced developer and I'm not sure. 
I know about Template_Hierarchy,
I wanted to use get_post_format() because I liked the code in index.php for 
Twenty Eleven:

   /* Start the Loop */ 
   while ( have_posts() ) : the_post(); 

          get_template_part( 'content', get_post_format() ); ?>

   endwhile;

This way they load content-page.php for page post type, content-gallery.php for 
gallery post types and so on.

In my case when post type is "mebli" it loads content.php.
I made an experiment and wrote

   /* Start the Loop */ 
   while ( have_posts() ) : the_post(); 

   $postType = get_post_format();
   echo $postType;
   exit;

   endwhile;

and nothing was shown on the screen. Which means that get_post_format() doesn't 
detect custom post type. This is my not professional opinion.

I can't solve this issue alone, so I'm asking you for support, because I like 
this plugin and use it almost in every project. :)

Regards

Original comment by bogastyl...@gmail.com on 19 Feb 2013 at 8:54

GoogleCodeExporter commented 9 years ago
You need to check the option to support post formats:
http://www.screencast.com/t/kfOZypumU

Original comment by ever...@fireproofsocks.com on 19 Feb 2013 at 6:15

GoogleCodeExporter commented 9 years ago
Hi and tanks for replay.

I checked this option, but it doesn't work again.

Take a look at this screencast http://screencast.com/t/VvKg1IskeS what I have 
and what I'm doing.

Mean while in this situation if I click on "Mebeli 1" it ;oads 
single-mebeli.php which is fine. 

But still can understand why never load content-mebeli.php.

This tests are made over new clean Wordpress instalation:
*SYSTEM INFO* 
------------------------ 
Plugin Version: 0.9.7-pl
WordPress Version: 3.5.1
PHP Version: 5.3.8
MySQL Version: 5.5.16
Server OS: WINNT
------------------------ 
ACTIVE PLUGINS: 
------------------------ 
CURRENT THEME: Twenty Eleven v.1.5 
http://wordpress.org/extend/themes/twentyeleven

Original comment by bogastyl...@gmail.com on 20 Feb 2013 at 8:27

GoogleCodeExporter commented 9 years ago
get_post_format always returns what I expect.

I can't reproduce this :(

Original comment by ever...@fireproofsocks.com on 2 May 2013 at 5:48

GoogleCodeExporter commented 9 years ago
Just close this issue and don't worry anymore. ;)
Probably my case is some kind of exception or it is my bad luck. 

Original comment by bogastyl...@gmail.com on 3 May 2013 at 9:20

GoogleCodeExporter commented 9 years ago
Sorry I couldn't duplicate it... there might be something weird going on here, 
I just couldn't find anything :(

Original comment by ever...@fireproofsocks.com on 3 May 2013 at 2:48