Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Montezuma Theme »

[SOLVED] Sorting by modification date


  #1  
Old Feb 16, 2013, 05:37 AM
arteny
 
22 posts · Nov 2012
Russia, Voronezh
Search [SOLVED] Sorting by modification date

How to do it?
I can do it adding
if( have_posts() ) :
// begin of my code >>
if (is_main_query()) :
query_posts($query_string.'orderby=modified');
endif;
// << end of my code
into begin of bfa_loop function (montezuma/includes/template_tags.php file)
but in this case all posts are shown each time not depend on if I select some tag or category. in correct order, but I don't need them all in those cases.

Last edited by arteny; Feb 16, 2013 at 09:07 AM.
  #2  
Old Feb 16, 2013, 07:39 AM
lmilesw's Avatar
lmilesw
 
10,176 posts · Jul 2009
Central New York State USA
I would use the List Category Posts plugin.
__________________
~Larry (CNY Web Designs)
This site should be a membership site since it so full of good stuff.
Please consider donating which gives you access to even more good stuff.
  #3  
Old Feb 16, 2013, 11:55 AM
arteny
 
22 posts · Nov 2012
Russia, Voronezh
Quote:
Originally Posted by lmilesw
I would use the List Category Posts plugin.
lmilesw, I installed it, but didn't understand how to use it. I got that I should write
[catlist categorypage="yes" orderby=modified]
But where should I put this pseudo-code?
  #4  
Old Feb 16, 2013, 12:11 PM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
you put shortcodes in posts or pages
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #5  
Old Feb 16, 2013, 12:28 PM
arteny
 
22 posts · Nov 2012
Russia, Voronezh
In this case this plugin nothing helps me.
If I put this pseudo-code in post or page it really show me list of links to posts with correct order here.
So I can do separate page which can show posts (excerpts are possible as well) with needed conditions.
But I don't need this list. I want to keep current standard behavior of index page - when I can click on tag or on category and it shows filtered posts. Only I need posts previews are sorted by modified date.
  #6  
Old Feb 16, 2013, 01:04 PM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
you could try making a child theme and using the is_main_query function to change the main query.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #7  
Old Feb 16, 2013, 03:31 PM
jerryc
 
367 posts · Oct 2012
Florida
If you can do it with php, you might be able to use the technique shown in this post.
  #8  
Old Feb 17, 2013, 02:16 AM
arteny
 
22 posts · Nov 2012
Russia, Voronezh
I found the solution:
use this snippet:

Code:
function order_posts_by_mod_date($orderby) {
  if  (is_home() || is_archive() || is_feed()) {
    $orderby = "post_modified_gmt DESC";
  }

  return $orderby;
}

add_filter('posts_orderby', 'order_posts_by_mod_date', 999);
just dump this snippet into functions.php

Bookmarks

Tags
modification date, sorting

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Page Menu drop down modification - remove arrows & extra space dorigen Page & Category Menu Bars 31 Aug 16, 2014 11:10 AM
PATCH 373-03: date-modified in post/page info items returns the date published juggledad Old Version fixes and change logs 0 Dec 30, 2011 06:41 PM
Modification article lecalve Atahualpa 3 Wordpress theme 0 Mar 23, 2010 04:33 AM
Page Menu Bar Sorting Dem Page & Category Menu Bars 5 Mar 6, 2009 03:22 PM


All times are GMT -6. The time now is 07:33 AM.


Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.