Recent Topics

1 Jun 13, 2012 05:18    

I need to create a new post type but can not see to find anything related to this. In the backend you can go to post types and create a new entry but that is all one can do.

I want to create a new post type similar to the Page post type except I don't want it to create a link in the navigation bar. I have searched the files trying to find the scripts that deal with post types. Therefore, if anyone can help me to know which files control the post types so I can add my own post type and have b2evolution to process that post type as it now does with the page post type, it would be appreciated very much.

2 Jun 13, 2012 06:38

Here's how you can find post type

if( $Item->ptyp_ID == 888 )
{
    // You are viewing post type 888
}

You can also add a Universal Item list widget to the Menu container, select your custom post type and then "Link titles" -> "Nowhere"

3 Jun 13, 2012 16:26

Thanks Sam for your answer. However, that is not quite what I want to do.

I want to create a new post type and then create the code used to process that new post type. I have searched through the b2evo scripts but having trouble locating the bits and pieces that handle processing the post types when you publish an article.

See, when you publish an article that has post type page, the b2evolution scripts checks the post type to know what it should do with the article. I want to work off the Page post type since there is no real data on creating your own post type, I can learn by examining the b2evolution code. So if you or someone else can tell me where to look for this, then it could save me hours of searching through the b2evolution scripts and that time can be used for writing code.

Thank you

4 Jun 13, 2012 17:16

OK, it just occurred to me that I am misunderstanding post-types. Each article I write is stored in the database the same way, but the post type field is set to different values.

Then at the time the page is rendered to the viewer is when the post type comes into play.

So my question is where is the code that handles the post types when the article is viewed?

5 Jun 13, 2012 17:57

So my question is where is the code that handles the post types when the article is viewed?

I wrote it above :)

Here's a more detailed example, edit /skins/evopress/_item_block.inc.php

<?php
	// ---------------------- POST CONTENT INCLUDED HERE ----------------------
	skin_include( '_item_content.inc.php', $params );
	// Note: You can customize the default item feedback by copying the generic
	// /skins/_item_content.inc.php file into the current skin folder.
	// -------------------------- END OF POST CONTENT -------------------------
?>

<?php
if( $Item->ptyp_ID == 888 )
{
	echo 'You are viewing post type 888';
}
else
{	// Display regular content for all other post types

	// ---------------------- POST CONTENT INCLUDED HERE ----------------------
	skin_include( '_item_content.inc.php', $params );
	// Note: You can customize the default item feedback by copying the generic
	// /skins/_item_content.inc.php file into the current skin folder.
	// -------------------------- END OF POST CONTENT -------------------------
}
?>


Form is loading...