The simpler media website CMS
hi
in search page, the news list is with title (or titlelink ?) order, but I want to list them with date (recent first) (as the default order in news loop on news page).
I have a look on next_news() paramaters, but there is no choice to do that.
In deprecated functions, I have the info that we have to set news order type and news order direction.
so I write this code in my search page:<?php if ($_zenpage_and_news_enabled && ($numnews > 0)) { $_zp_current_search->setSortType('date', 'news'); $_zp_current_search->setSortDirection(1, 'news'); ?> <h4 class="margin-top-double margin-bottom-double"><strong><?php printf(gettext('Articles (%s)'), $numnews); ?></strong></h4> <?php while (next_news()) { ?> <div class="list-post clearfix"> <h4 class="post-title"><?php printNewsURL(); ?></h4> <div class="post-content clearfix"> <?php echo shortenContent(getBare(getNewsContent()), 200, getOption("zenpage_textshorten_indicator")); ?> </div> </div> <?php } } ?>
but it has no effet on news order.
what is wrong ?
Comments
btw, the markdown doesn't very well on my example.
I follow the rules of indentation, but it doesn't wwork on html code and I don't know what is wrong.
Your code example looks fine formatted for me? Alternatively you can also use plain html for formatting as well.
Yes, you need to set the order via the search object. I can't say offhand but it might be already to late to set these values in that place. I have a far memory about an older forum post or something I can't find that you even might need to do this within the theme's functions.php. Have to try myself later today.
Also clear or disable the search cache just to be sure this doesn't interfere for unknown reasons.
@vincent3569: FYI, I put your code between backticks to make it look a bit better.
ok, I tested by adding this code in function.php:
and it works fine for news order, but it doesn't work with pages (I tested with 'title' and 'date', but with no effect on sorte order).
btw: don't you think it could be a search parameter as it is the same one for album and image search order, set in admin>options>search?
Have to try myself later when I get the time. It should work for any item type like this. Btw, instead of
0/1
better usetrue|false
as actually meant (although it should come down to the same).Yes, absolutely, default options for news and pages are actually on the list! Just didn't get to it
It seems I can reproduce the issue with pages. Thanks for the ticket, would not have been necessary though.