Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+9 votes
1.1k views
in Q2A Core by
For example a question that is always on the top to make announcements and etc.

This would be rare so even setting the page to display a question by the ID at the top first would work.

1 Answer

+4 votes
by
 
Best answer
Great question!

It's not yet possible to do this via the admin interface, but a bit of PHP can do the trick. In qa-page-home.php, insert the following code:

array_unshift($questions,
  qa_db_single_select($qa_db,
    qa_db_full_post_selectspec($qa_login_userid, 392299)
  )
);

...after...

$questions=qa_any_sort_and_dedupe($questions);

You'll need to modify 392299 above to be the ID of the question you want to make sticky - you can see this from its URL.
by
And if you only want it sticky on the first page, add the following line just before:

if ($qa_start==0)
by
Thanks, works great.
by
where is this file existing? qa-page-home.php
by
Is this still not possible? Seems easy enough to add a sticky field and sort by sticky.
by
In ver 1.6.3, the page is called qa-page-default.php I believe. I implemented this code as describe above and it fails returning undefined variable notices for qa_db and qa_login_user. There is a plugin by NoahY that does this, but also has its limitations.
...