Recent Topics

1 Jun 24, 2010 12:38    

My b2evolution Version: Not Entered

I have 3 types of posts, but they are not blog-wise, rather site-wise, so instead of categories, i assumed i can use post-type.

Dont need anything special, i ll just duplicate default "post" post-type 3 times, and rename them..

What i need is; show default "post" type but exclude the "post-2" and "post-3" from the post loop, and requesting 2nd and 3rd loop by clicking.

I believe i can do this via custom display, but i dont know what to type in to filter post loop by post-type...

Is there sth like

while( $Item = & mainlist_get_item() & $Item -> post_ptyp_ID == 5001 )

2 Jun 24, 2010 12:58

Top of your index_main.php

if( !defined( 'whatever-var-it-is' ) ) die()

global $posttypes_reserved_IDs;
$posttypes_reserved_IDs = array_merge( $posttypes_reserved_IDs, array( your-new-post-ids-comma-separated ) );

// rest of file

¥

3 Jun 24, 2010 13:28

¥åßßå wrote:

Top of your index_main.php

if( !defined( 'whatever-var-it-is' ) ) die()

global $posttypes_reserved_IDs;
$posttypes_reserved_IDs = array_merge( $posttypes_reserved_IDs, array( your-new-post-ids-comma-separated ) );

// rest of file

¥

what is 'whatever-var-it-is' ? the custom disp ?

i could not understand exactly what the above code does.. i am not trying to merge anything, the post loop includes all post types already, iam trying to split/filter them by 3

4 Jun 24, 2010 14:03

The whatever var is EVO_APP_LOADED or something, it's in pretty much every file near the top.

Adding the above code, after replacing it with your new post ID's will remove them from the normal post loop

¥

5 Jun 24, 2010 15:11

¥åßßå wrote:

The whatever var is EVO_APP_LOADED or something, it's in pretty much every file near the top.

Adding the above code, after replacing it with your new post ID's will remove them from the normal post loop

¥

following your explanations, i ve put this:

if( !defined( 'EVO_MAIN_INIT' ) ) die( 'Please, do not access this page directly.' );

global $posttypes_reserved_IDs;
$posttypes_reserved_IDs = array_merge( $posttypes_reserved_IDs, array( 5001, 5002 ) );

But nothing happens really, everything is the same

6 Jun 24, 2010 16:03

Oh yeah, forgot about that evo bug :p

The list is hard coded in itemlislight.class.php ( and it should be $posttypes_locked_IDs )

¥

7 Jun 24, 2010 16:09

¥åßßå wrote:

Oh yeah, forgot about that evo bug :p

The list is hard coded in itemlislight.class.php ( and it should be $posttypes_locked_IDs )

¥

tried that too, still no change.

8 Jun 24, 2010 16:26

Hmmm, wonder if there was more than one bug then, because that works in my software of choice ;)

¥

9 Oct 14, 2010 05:37

I'm using b2evo 3.3.3 and wanted to do something similar: not include a particular post type (called "sidebar post") in the normal post display.

I ended up hacking the core file inc/items/model/_item.funcs.php and defining my own default filters in the init_MainList() function:


if( $disp == 'page' )
                {       // Get  pages:
                        $MainList->set_default_filters( array(
                                        'types' => '1000',              // pages
                                        // 'types' => '1000,1500,1520,1530,1570',               // pages and intros (intros should normally never be called)
                                ) );
                }
                // else: we are either in single or in posts mode
                // 2010/10/13 - ckm - have to specify which post types to
                // ckm - display. I don't want "sidebar posts" displaying
                // ckm - in the main area, so they are not included
                $MainList->set_default_filters(array( 'types' => '1,1000,2000' ));

I recognize this is a complete hack and will likely lose this change upon upgrade. I tried the $posttype_reserved_IDs recommended above (as well as $posttypte_locked_IDs), but it did not work for me. The comment in item_types.ctrl.php says "// Prevent editing of reserved and locked post types", so it does not seem like this is the right method of preventing these post types from being displayed on the blog, unless this variable is used for other purposes.


Form is loading...