Making Posts Sticky?

9 views
Skip to first unread message

Simeon

unread,
Oct 28, 2009, 5:04:50 PM10/28/09
to Pixie
Is there a way to make certain posts stay at the top?

There are a couple of articles we want to run that I would like to
remain sticky so that newer posts can flow under them.

Thanks for the help,
Simeon

Joel

unread,
Nov 4, 2009, 7:11:24 PM11/4/09
to Pixie
I also would like this feature.

On Oct 28, 3:04 pm, Simeon <soundcreations...@gmail.com> wrote:
> Is there a way to make certain posts stay at the top?
>
> There are a couple of articles we want to run that I would like to
> remainstickyso that newer posts can flow under them.

rm

unread,
Nov 11, 2009, 11:54:02 PM11/11/09
to Pixie
If you go to the Publish->Pages tab and then Edit the entry you would
like to be "sticky", you can just change the Date & Time setting to be
more recent than other posts. That will keep the post at the top of
the list. It's not _really_ making the post sticky but it has a
similar effect.

rm

unread,
Nov 13, 2009, 11:29:11 AM11/13/09
to Pixie
If you want to try this, first make a backup of admin/modules/
dynamic.php. Then, edit dynamic.php around the following lines (the
line numbers may not be the same in your file as mine, so look for the
matching code):

original 118 is: $rs = safe_rows_start("*", "pixie_dynamic_posts",
"page_id = '$page_id' and public = 'yes' and posted < now() order by
posted desc limit $start,$posts_per_page");

change 118 to: $rs = safe_rows_start("*, title RLIKE '^\\\\[Top
Story]' AS sticky", "pixie_dynamic_posts", "page_id = '$page_id' and
public = 'yes' and posted < now() order by sticky desc, posted desc
limit $start,$posts_per_page");

original 132 is: $rs = safe_rows_start("*", "pixie_dynamic_posts",
"page_id = '$page_id' and public = 'yes' and posted < now() and tags
REGEXP '[[:<:]]". $x ."[[:>:]]' order by posted desc limit $start,
$posts_per_page");

change 132 to: $rs = safe_rows_start("*, title RLIKE '^\\\\[Top
Story]' AS sticky", "pixie_dynamic_posts", "page_id = '$page_id' and
public = 'yes' and posted < now() and tags REGEXP '[[:<:]]".
$x ."[[:>:]]' order by sticky desc, posted desc limit $start,
$posts_per_page");

original 138 is: $rs = safe_rows_start("*", "pixie_dynamic_posts",
"page_id = '$page_id' and public = 'yes' and posted < now() and tags
REGEXP '[[:<:]]". $x ."[[:>:]]' order by posted desc limit
$posts_per_page");

change 138 to: $rs = safe_rows_start("*, title RLIKE '^\\\\[Top
Story]' AS sticky", "pixie_dynamic_posts", "page_id = '$page_id' and
public = 'yes' and posted < now() and tags REGEXP '[[:<:]]".
$x ."[[:>:]]' order by sticky desc, posted desc limit
$posts_per_page");

original 152 is: $rs = safe_rows_start("*", "pixie_dynamic_posts",
"page_id = '$page_id' and public = 'yes' and posted < now() order by
posted desc limit $posts_per_page");

change 152 to: $rs = safe_rows_start("*, title RLIKE '^\\\\[Top
Story]' AS sticky", "pixie_dynamic_posts", "page_id = '$id' and public
= 'yes' and posted < now() order by sticky desc, posted desc limit
$posts_per_page");

Then, if you preface your blog posts with [Top Story] those posts will
always appear at the top of the list. Basically, what the queries are
doing is returning a value of 1 or 0 respectively to the alias
'sticky' if the regular expression finds [Top Story] at the start of
the title or not. Then, the query sorts all the results first by
sticky, and then by date.

Scott

unread,
Nov 14, 2009, 3:52:09 PM11/14/09
to Pixie
This feature is not currently available - as RM suggests, its a bit of
a hack but could be done.

Scott
Reply all
Reply to author
Forward
0 new messages