Possible Fix for Sticky Problems in function &get_posts()
-
Restricting the front page to just one category by placing the following before “The Loop” by using:
<?php //if (is_front_page()) { query_posts(“cat=1”); } ?>
or during The Loop by using:
<?php if (is_front_page() && ! is_category(‘1’))contine; ?>
breaks the “Sticky Posts” from appearing at the top.
In the function &get_posts() wp-includes/query.php in the section that is commented as:
// Put sticky posts at the top of the posts array
there is a line of code:if ( $this->is_home && $page <= 1 && is_array($sticky_posts) && !empty($sticky_posts) && !$q[‘caller_get_posts’] ) {
if the $this->is_home test is removed the sticky post work fine. The new line of code should read:
if ( $page <= 1 && is_array($sticky_posts) && !empty($sticky_posts) && !$q[‘caller_get_posts’] ) {
This is a possible fix, because I still do not understand why the is_home test fails. I still need to understand why sticky post are restricted to the home page anyway. Does anyone know the strict definition of the home page? How does the home page get set during runtime? Any other advise would help.
Thanks
The topic ‘Possible Fix for Sticky Problems in function &get_posts()’ is closed to new replies.