Recent Topics

1 Oct 22, 2008 18:10    

My b2evolution Version: Not Entered

I had to think twice before asking another question, but I cannot seem to find the answer anywhere.

Is there away to keep a post at the very top and leave it there. I know from using other blog platforms if you keep writing posts then the older ones go down the page unless you add a widget to the content part such as blogspot you can add container and leave it there and it won't move. Can you do that with b2 as well.

Thank you in advance!
Jen

2 Oct 22, 2008 22:31

Hi allkindsofreviews,

If you are using B2evolution 2.4.5 it's easy, but you'll have to take a few steps:
1) in Dashboard -> Global settings -> Post types add a new element called Sticky (or whatever name) It will have an ID of 5001

http://www.blog.hemminga.net/B2evoforum/Sticky-1.png

2) Open /blogs/index.php and add one line just before the end so the end looks like this:

// Stickies go first
$orderby = 'ptyp_ID datemodified'; 

// That's it, now let b2evolution do the rest! :)
require $inc_path.'_blog_main.inc.php';

?>


The line $orderby is the one that is altered.

Now when you write or edit a message you have an extra type (Sticky) for posts that will stay on top.

http://www.blog.hemminga.net/B2evoforum/Sticky-2.png

Note: I used datemodified as second sort order argument. You may want datecreated there.

Good luck

4 Oct 23, 2008 00:44

Thank you so very much!! :)

5 Oct 25, 2008 20:57

I tried this and it didn't work. I know you mentioned datecreate. How do you do that?

6 Oct 25, 2008 22:48

Simply replace datemodified, in the code Afwas posted above, with datecreate

7 Oct 26, 2008 00:21

I just give up none of this worked. When I inserted Datecreate it messed up the blog so I had to put it back to date modified.

8 Nov 06, 2008 08:44

Hi there.

This is a feature I'd like to have. Has anyone gotten it to work properly (before I try it)? :?:

Thanks.

9 Nov 06, 2008 13:56

This works.
If it doesn't work check if you're using stubfiles (Blog settings -> URLs). In v 2.4.5 the stubs are most likely called blog1.php through blog9.php. In that case you do not alter the index.php file but the stub file instead.

Good luck

10 lxsparks Nov 08, 2008 23:11

lxsparks

I tried this and got the following error message after clicking on a post (so the post opens in full):

"WARNING: unhandled sorting: ptyp_IDWARNING: unhandled sorting: ptyp_ID".

I have four blogs and each one is fine until you view an individual post. I assume it's to do with a search string, but why would it cause an error when it works on the previous page?

Incidentally I also tried changing 'datemodified' to 'datecreated' but that really fouled the system.

UPDATE:- found a post which sorts this problem out so thought it would be helpful to put a pointer here for it: http://forums.b2evolution.net/viewtopic.php?t=15184

11 Nov 19, 2008 16:00

I got the sticky to install and work just fine - except when I no longer want it to be a sticky (I edit the post and change the post type from sticky to post) - it stays at the top of the blog. Thoughts? It's like it considers it a new post - even though the date is still the original post date of 11/4.

12 Nov 26, 2008 18:54

I have since written more posts, so now the once-sticky entry has moved down the page, but it's still out of order date wise.

Anyone?

Not life or death, just annoying. :)

13 Nov 28, 2008 22:48

I can be oh so simple and not need 2.4.5

I used this code in place of the one above in order to get my sticky to show up, and in order to also have my blog be in chronological order even when the sticky is removed.

// Stickies go first
$orderby = 'ptyp_ID datestart';

15 Jan 29, 2009 12:44

OT: blogmeister there was no need to tack a "look at this post" to everything related. Good find & potentially good fix for those into using the post type hack, but ... pointing everything to it doesn't really add value.

16 Jan 29, 2009 21:33

I appreciate your sentiment, EdB and agree in some cases but for those that asked for help or for just being proactive so that new users don't experience certain problems, it is sometimes easier to refer to a thread than to repeat the answer in its entirety.

17 Feb 09, 2009 04:18

Hello.

I just ran across this situation:

I have a post I want to keep in the #1 position in the sticky post listing, but because the new sticky post was created later and is then the most recent sticky post, it of course wants to take over that #1 position.

Any ideas, without altering a post's date, to have like a 2-tiered sticky post area? 1st tier for say, the #1 and #2 positions that could be more permanent postings and the 2nd tier would begin date-ordered sticky posts? :?:

Thanks in advance.

18 May 20, 2009 18:27

Afwas wrote:

This works.
If it doesn't work check if you're using stubfiles (Blog settings -> URLs). In v 2.4.5 the stubs are most likely called blog1.php through blog9.php. In that case you do not alter the index.php file but the stub file instead.

I am using stub files. My question is, do I have to modify each of the stub files (blog1.php through blog9.php) to get the stickies to work? AND, do I just add the "stickies" code from above, or do I need to add something else in addition...AND where do I add it?

Thanks in advance!

19 Jun 17, 2009 18:40

Hi Afwas. Refering to your FAQ http://forums.b2evolution.net/viewtopic.php?t=17036

In 2.4.6 are you saying that only the file [/inc/items/model/_itemlist.class.php] needs the extra case and there is no need to add type 5001:Sticky, or do both have to be done.

I've done both and nought happens. I noticed that 3000 was also a sticky so I went to the database and renamed it Reserved.

Thanks

By the way I have stubs and put the code in there and the index.php

SORTED: Thanks Afwas. I have the 5001:Sticky and modified the blush.php which is the 'real' stub file.

Thanks again

20 Jun 17, 2009 18:52

Hi delweldj

Hope you got it sorted by now its been a few weeks since your post. As I understand from earlier post, above, you enter the code before the last line of the stub files you mentioned, for each blog you want stickies to work for.
i.e before this:


// That's it, now let b2evolution do the rest! :)
require $inc_path.'_blog_main.inc.php'; 

Sadly I haven't yet got it to work yet

SORTED: See next post

21 Jun 17, 2009 19:27

Update: OK 'm getting there slowly.
Given that I modified the blog2.php, if I use blog2.php in the URL it works fine, but I'm now checking the issue with the named blog as blog2 directs to a folder [blush] which has its own blush.php and index.php which are the actual final parts of the url, rather than blog2.php

Final Update: Ok its sorted. had a blush.php file in the root folder which is the 'real' user friendly stub file. Modifying that got it working.

Thanks all


Form is loading...