Recent Topics

[4.1.x] Trouble With Featured Post

Started by on Sep 05, 2012 – Contents updated: Sep 05, 2012

Sep 05, 2012 22:48    

My b2evolution Version: 4.1.x

The first post is the featured post but the posts below shouldn't be showing. I've added


if( $Item->ptyp_ID == 1500 ) $GLOBALS['MainList'] = NULL;
but it doesn't seem to be preventing the other posts from showing. Ideas anyone?

Sep 06, 2012 03:35

Where did you put this code? It should go somewhere above the main posts loop.

Sep 06, 2012 05:28

It's currently at the end of the Featured Posts section in the posts.main.php file which appears to be above the main post area but maybe I'm missing something... ?

Sep 06, 2012 20:16

Try this


if( $Item->ptyp_ID == 1500 ) echo 'Yes, I am really an intro post!';

Sep 07, 2012 01:57

Thanks Sam2kb - I replaced my code with what you provided and it appears to have no effect.

Sep 07, 2012 07:14

Then the post is not of type 1500
Use $Item->is_intro() instead


if( $Item->is_intro() ) echo 'Hooray! I\'m an intro post!';

Sep 07, 2012 19:24

Again, no effect. Not sure what the problem is but something is obviously broken...

Sep 07, 2012 20:29

Try this


echo $Item->ptyp_ID;

Sep 07, 2012 21:08

It put a "1" (no quotes) below the post.

Sep 07, 2012 21:15

Well, the Featured Post box is checked - I've even unchecked it, saved, rechecked it and saved again. Any ideas?

Sep 07, 2012 21:33

Ok, I see it now. There's a difference between featured and intro posts

Your post is not intro that's why it doesn't respond to is_intro() check. Add this


if( $Item->is_intro() || $Item->is_featured() ) echo 'Either intro or featured post';

Sep 07, 2012 21:45

Ok, that makes sense. So then what should I replace my original code


if( $Item->ptyp_ID == 1500 ) $GLOBALS['MainList'] = NULL;
to make it so the featured post is the only post that shows up?


I'm an idiot.

I should have had it set to Intro the whole time. So sorry to waste your time - I'm retarded.

Sep 07, 2012 22:03


if( $Item->is_intro() || $Item->is_featured() ) $GLOBALS['MainList'] = NULL;

Sep 07, 2012 22:06

Man, I feel like a total jackass. I'm really sorry!

Form is loading...

Free CMS – This forum is powered by b2evolution CMS, a complete engine for your website.