Recent Topics

1 Oct 22, 2008 22:53    

== Update ==
B2evolution 2.4.6 seems to suffer from a regression (an old bug). The enable Sticky posts you want to open /inc/items/model/_itemlist.class.php. On or around line 567 you find a list. In this list you want to add ptyp_ID so it looks like

567 		case 'title':
			case 'datecreated':
			case 'ptyp_ID': // <-- Add this line
			case 'datemodified':
			case 'urltitle':
			case 'priority':	// Note: will skip to next priority level


Also: in this text was mentioned you can add as second display order 'datecreated' or datemodified'. It turns out I missed the most important one: 'datestart' will order the posts based on issue date/time.

--

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 (do not worry if the ID is not exactly 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.
-- Update --
To order posts based on Issue Date use 'datestart' as second argument.
Note 2: If you are using stub files (and you will know if you do) you will need to alter the appropriate stub file and not index.php

If you want the title of sticky posts coloured (red) you can change the _index.main.php (in some skins you want to change the _posts.main.php) and find

<h2 class="evo_post_title"><?php $Item->title(); ?></h2>


Change that to:

		<?php
		if ( $Item->ptyp_ID == "5001" )
		{
		?>
			<h2 class="evo_post_title evo_post_title_red"><?php $Item->title() ?></h2>
		<?php
		}
		else
		{
		?>
			<h2 class="evo_post_title"><?php $Item->title(); ?></h2>
		<?php
		}
		?>


In the style.css file add:

.evo_post_title_red {
    color: red;
}

Good luck[/b]

2 Jan 29, 2009 00:48

On a related note, b2evolution 3.0.0 implements Featured posts and Intro posts. We will probably also add sticky posts.


Form is loading...