Search Results for 'sort modified'

Results from the Forum
Gil Poulsen
tagDiv Member

Hey, thanks for this and I have a somewhat easier way of implementing an alternate sort, in my case sort posts by last MODIFIED date, not last PUBLISHED date. With my method you have to “sacrifice” one of the existing sorts and in my case I decided to replace the “Oldest posts” since I know I would not ever use that one.

It’s only two files you need to change, make sure you back them up and also understand that when you do a theme update these will be overwritten so you will want to keep copies. These apply to v. 8 of the theme.

First make the below changes to includes/td_config.php, starting at line 7351:

array(
“param_name” => “sort”,
“type” => “dropdown”,
“value” => array (
‘- Latest -‘ => ”,
// Sacrificing the ‘oldest posts’ sort, we’ll never use it
Modified date’ => ‘oldest_posts’,

Then make this change to includes/wp-booster/td_data_source.php, starting at line 116:

$wp_query_args[‘cat’] = get_cat_ID(TD_FEATURED_CAT); //add the featured cat
break;
case ‘oldest_posts’:
// Replaced by me w/sort by modified date, newest first
$wp_query_args[‘orderby’] = ‘modified’;
$wp_query_args[‘order’] = ‘DESC’;
break;
case ‘popular’:

That’s it. Now when you are doing a grid sort you will see Modified date instead of Oldest posts. This is sorting most recently modified first (‘DESC’) but if for some reason you wanted the oldest by modified date you could change it to ‘ASC’.

Also, in case anyone is not aware of this, there is a free plugin called “Last Modified Timestamp” that will add a Last Modified Date column to your Posts and Pages admin screens. For what we do as a newspaper, in most cases the last time o post was modified is much more important than the published date of a post as far as which posts to display in the grid(s).

Hope this helps somebody and thanks to everyone who posts solutions like these as many of them have helped me in the past.

Catalin
tagDiv Staff

Hello Newstrack,

I guess that you want to sort your posts by modified/updated, right? Unfortunately, notice that type of sorting does not exist in our theme, sorry! If you want to achieve this, you simply should copy/paste this to another new post (create it) and this will the latest one and will be displayed as you wish.

Thanks for your understanding!

Simion C.
tagDiv Staff

Hi,

The Big grids and blocks used have options that you can use to filter and sort the content that is displayed in them. Here you can find all the settings and options available for them
https://forum.tagdiv.com/block-settings-guide/
You can filter by category or categories, then sort the posts as you wish.
The date displayed format can be modified in the WordPress settings
https://www.screencast.com/t/mguT1kZD1hYR
But I believe for specific demands like you mention, you probably will need a plugin that has additional options. You can search for plugins with those capabilities and choose the one that you think it’s best.

Thanks

rakeshquilon
Participant
#0

Hi

for one of my widget in home page (newspaper 7) i wanted to show the posts by the last modified date sort order. By default there in no such sort order. is there any way to manually add the ‘date modified’ sort order ?

I contacted visual composer, according to them they have such option by default but the blocks comes with newspaper theme is customized and should contact the theme support for that.

Regards
Rakesh

haychart
tagDiv Member

I am just about to update my site and I am getting all my modified pages sorted first including custom ad spots

I just opened the link for td_panel_ads.php – above and it looks like the 7.4 version i am upgrading from

the 7.6 version i just downloaded has only the following 58 lines of code

what am i doing wrong

<?php

td_api_ad::helper_display_ads();

?>

<?php
//backround add
echo td_panel_generator::box_start(‘Background click Ad’, false);?>

<div class=”td-box-row”>
<div class=”td-box-description td-box-full”>
<span class=”td-box-title”>Notice:</span>
<p>Please go to BACKGROUND tab if you also need a background image</p>
</div>
<div class=”td-box-row-margin-bottom”></div>
</div>

<!– ad box code –>
<div class=”td-box-row”>
<div class=”td-box-description”>
<span class=”td-box-title”>URL</span>
<p>Paste your link here like : http://www.domain.com</p&gt;
</div>
<div class=”td-box-control-full td-panel-input-wide”>
<?php
echo td_panel_generator::input(array(
‘ds’ => ‘td_option’,
‘option_id’ => ‘tds_background_click_url’,
));
?>
</div>
</div>

<!– ad taget –>
<div class=”td-box-row”>
<div class=”td-box-description”>
<span class=”td-box-title”>Open in new window</span>
<p>If enabled, this option will open the URL in a new window. Leave disabled for the URL to be loaded in current page</p>
</div>
<div class=”td-box-control-full”>
<?php
echo td_panel_generator::checkbox(array(
‘ds’ => ‘td_option’,
‘option_id’ => ‘tds_background_click_target’,
‘true_value’ => ‘_blank’,
‘false_value’ => ”
));
?>
</div>
</div>

<?php echo td_panel_generator::box_end();?>

  • This reply was modified 9 years by haychart. Reason: typo
Bogdan B.
tagDiv Staff

Hello,

The articles on the homepage will not appear based on their last modified date but rather the last published bost. There ism no such sorting option added in our theme. For this you will have to ask your programmer to create a new sorting option. Here is an example of how a new sorting can be added: https://forum.tagdiv.com/topic/implemented-new-sort-most-popular-among-posts-of-last-7-days/

Thank you!

skajic
tagDiv Member

Here you have a sample code which I have little bit modified, so it should be easy for you to check the “meta_key” and the value of it that this code can run with your theme. It’s not so hard for sure for you to do it, as this code will make the “Views” colum sortable but it has small bugs, so if you can solve them would be good for the community for sure.

// Register the column
function td_post_views_column_register( $columns ) {
$columns[‘td_post_views’] = __( ‘Post Views’, ‘my-plugin’ );
return $columns;
}
add_filter( ‘manage_edit-post_columns’, ‘td_post_views_column_register’ );

// Display the column content
function td_post_views_column_display( $column_name, $post_id ) {
if ( ‘td_post_views’ != $column_name )
return;

$td_post_views = get_post_meta($post_id, ‘post_view_counter_key’, true);
if ( !$td_post_views )
$td_post_views = ‘‘ . __( ‘undefined’, ‘my-plugin’ ) . ‘‘;
echo $td_post_views;
}
add_action( ‘manage_posts_custom_column’, ‘td_post_views_column_display’, 10, 2 );

// Register the column as sortable
function td_post_views_column_register_sortable( $columns ) {
$columns[‘td_post_views’] = ‘td_post_views’;
return $columns;
}
add_filter( ‘manage_edit-post_sortable_columns’, ‘td_post_views_column_register_sortable’ );

function td_post_views_column_orderby( $vars ) {
if ( isset( $vars[‘orderby’] ) && ‘td_post_views’ == $vars[‘orderby’] ) {
$vars = array_merge( $vars, array(
‘meta_key’ => ‘post_view_counter_key’,
‘orderby’ => ‘meta_value_num’
) );
}
return $vars;
}
add_filter( ‘request’, ‘td_post_views_column_orderby’ );

PS: Th only problem which I am getting is the stuff with “get_post_meta” and the one for the “meta_key”, so please take a look it should work with your input and modification.

  • This reply was modified 9 years by skajic.
Bogdan B.
tagDiv Staff

Hi,

3) Sorry but the modules cannot be modified. They do not have block settings like blocks do. On categories you can only select the style you want to have but the posts will be only in the latest sorting order. You cannot use visual composer on categories.

4) This is the case with css. It affects all of the elements sharing the same classes so the code has to be made proper by a developer that has the time to think of all the possible implications :). Css is a very complex part of a site. Please remove the custom css I provided as it cannot be re-written at the moment as I added !important tags to it. Remove the code and let meknow about it so i can access your site again and provide the correct version of the code that will not affect the mega-menu.

Thank you!

admindoxa
Participant
#0

Hello, i’m creating a native apps based on wordpress site powered by newspaper. In one of the block i’m using sort popular post by last 7 day .

I dig deep into meta_key and meta_value and assume there are ‘post_views_count_7_day_total’ and ‘post_views_count_7_day_last_date’ that control the query.. in order to create compatible json with wordpress json api v2.. i create this custom query:


SELECT
mm_posts.ID as id,
mm_posts.post_date as
date ,
mm_posts.post_date_gmt as date_gmt,
mm_posts.guid,
mm_posts.post_modified as modified,
mm_posts.post_modified_gmt as modified_gmt,
mm_posts.post_name as slug,
mm_posts.post_type as type,
mm_posts.post_name as link,
mm_posts.post_title as title,
mm_postmeta.meta_value
FROM
mm_posts
Left Join mm_postmeta ON mm_postmeta.post_id = mm_posts.ID
WHERE
mm_posts.post_type = "post" AND
mm_posts.post_status = "publish" AND
mm_postmeta.meta_key = "post_views_count_7_day_total" AND EXISTS(
SELECT
mm_postmeta.post_id
FROM
mm_postmeta
WHERE
mm_postmeta.meta_key = "post_views_count_7_day_last_date" AND
mm_postmeta.meta_value BETWEEN UNIX_TIMESTAMP(DATE_ADD(CURDATE(),INTERVAL -7 DAY)) AND UNIX_TIMESTAMP(now())
)
ORDER BY mm_postmeta.meta_value DESC, mm_posts.post_date ASC

Can you clarify if i make query right ?

Thanks

IamLegend
tagDiv Member

Hi Andrei,

I want to set the post globally sorting by modified date. So basically whenever someone edit the post it will jump on top of the list.

Thank you

Andrei L.
tagDiv Member

Hi

I assume that you want to display in blocks last edited/updated posts. Unfortunately the theme does not have a filter which sort posts by modified date, sorry.
If this is not what you mean please provide more detail about what you’re trying to do so I can inspect it closer and get back to you with a more accurate answer.

Thanks!

Emil G
tagDiv Staff

Hi,

If you use a cache plugin this feature won’t work properly. Try to hit refresh on a post which currently appears on the widget and check if the count gets modified on the backend – http://screencast.com/t/4P0uSkm2WWBkhttp://screencast.com/t/5ynUc9FT

Also make sure that the 7 Days post sorting option is enabled in Theme Panel – http://screencast.com/t/oa8WiMZMz

Thank you!

Emil G
tagDiv Staff

Hi,

1. Try the solution provided here – https://forum.tagdiv.com/topic/how-to-add-last-updated-time/
2. You mean you want to change the sort order for archive pages? and on the blog page?
For this you have to look for a plugin or a piece of code similar to this:

add_action('pre_get_posts','sort_posts_by_modified');

function sort_posts_by_modified($x) {
	if($query->is_main_query() && is_archive()) {
		$x->query_vars['orderby'] = 'modified';
		$x->query_vars['order'] = 'ASC';
	}
}

Beside is_archive you can add multiple conditions to target various page, you can read about it here – https://codex.wordpress.org/Conditional_Tags
If you don’t know how to do this i suggest that you look for a professional to help you with this task, you can find one on places like – http://studio.envato.com/

Thank you!

  • This reply was modified 10 years by Emil G.
  • This reply was modified 10 years by Emil G.
MN-theme
tagDiv Member

Hi guys, we are experiencing this same issue on GottaBeMobile.com and are going to switch to another theme because of it until we can sort out a fix.

The issue is that your Published times are localized and don’t include a Timezone offset trailing the time stamp. If you were able to add that it would solve the issue.
Could you please take a look at this document and see that Google is asking publishers to either provide the times in UTC by adding a ‘Z’ at the end of the timestamp or present the local time, but provide an hours offset.
https://support.google.com/news/publisher/answer/74288?hl=en
In our case, our articles are hitting the Google News index immediately, but showing up as “7 hours ago” in Google’s main web search engine results page. We tried switching to another theme for part of a day and Google immediately began indexing articles in Google News and Google Web search engine results pages with the correct time stamp.
Could you tell me if there’s a way to add the timezone offset into the theme?

If you don’t have a trailing ‘Z’ to indicate that the time is UTC or a time offset, then Google will simply assume that the PublishedDate and ModifiedDate are UTC times in Google SERPs, even if the desired time is showing up in Google News.

  • This reply was modified 10 years by MN-theme. Reason: added details
Roney
tagDiv Member

restored the ancient menu.php file and is appearing this error now inside the panel

usort]: Array was modified by the user comparison function in /home/yenor/public_html/wp-admin/includes/menu.php on line 299

Emil G
tagDiv Staff

Hi,

A solution may be to filter by slug, and add another sort order – http://screencast.com/t/PAoXbsrUCFhttp://screencast.com/t/IsdbNKAK20f

You could also try the modified date instead of the date parameter – http://screencast.com/t/00HGwemX

Modify each post and save it in order you want to appear.

The option will appear on the block settings – http://screencast.com/t/lclJAUuNrN44

http://pastebin.com/iBbF0g6d

Other solutions require more complex modifications on the blocks code, if you need that i suggest that you hire a professional to modify it for you.

Thank you, Emil G.

  • This reply was modified 11 years by Emil G.
  • This reply was modified 11 years by Emil G.
  • This reply was modified 11 years by Emil G.
  • This reply was modified 11 years by Alin [tagDiv].
Bryson T
tagDiv Member

And as some people are commenting on the forums already, Speed Booster also loads default theme colors for a split second before the modified style settings are enforced. So it’s definitely a use at your own discretion sort of thing.

I’d say a caching plugin is required to use with News Mag, but the Speed Booster plugin is entirely optional and depends on several variables including your theme colors and the amount of plugins loading javascript on each page. If you don’t have a large .js load then Speed Booster may not be needed at all.

Alin [tagDiv]
tagDiv Staff

Hi,

Unfortunately there is no option to sort post by modified date. The theme sort by the creation date, so the sort order Latest is mean that will take last posts added not updated(modified). Sorry for inconvenience!

Thanks!

simchris
tagDiv Member

Yes, I do 🙂

What I often do, is open two windows on my PC

one folder is the new theme update, one window is old theme update;
I do “sort by date” which pushes the modified files to top.

Then I open the old one, and then the new one and make changes to match.

I also make backup for my custom CSS each time, do a full FTP backup, and do tools > export, each time, out of general paranoia.

Lucian
tagDiv Staff

Hi,

Regarding to your second matter from your first post please note that the theme doesn’t have an option. You could assign an author (user) for each post manually from here: http://screencast.com/t/LsfObBNIQ bat you can’t set a custom URL for it so I suggest you try to find a plugin similar to the one you’ve mentioned or alter the code as you like here: http://screencast.com/t/bU1Gon4qapKJ

1. The title excerpt can be modified from here: http://screencast.com/t/dEcKqWYGIMiL
2. Add 'sort'=>'random_posts' like this: http://screencast.com/t/XoHogueI

Thanks

TheMediumUTM
Participant
#0

On the fourth post template, I’m getting a very strange placement of the title when there’s no featured image. (I have modified my loop-single-4 and single_template_4, but I already switched back to the parent theme versions to test this, and it still happens.)

Here’s what it looks like with a featured image:

http://www.screencast.com/t/ywzjdsUvO0C

Seems good to me. But here’s what happens without one. (The text is selected, it doesn’t have a background):

http://www.screencast.com/t/M3pKXn9Bul

Hmm…

On a similar note, let’s say I want to use has_post_thumbnail to sort out the template, so that it works like normal if there is one but looks more like style 2 if not. Would that solve my problem?

simchris
tagDiv Member

REF: changes since 3.2
======================
V 3.5 – 21 March – The list of modified files
◾added 4 predefined style: SPORT, CAFE, FASHION, TECH – screenshot
◾added option to uppercase the font for the Header Menu – screenshot
◾added Alphabetical A -> Z sorting option
◾added option to change the typography of the default Blockquote in Theme panel – screenshot
◾added COLOR option for default Blockquote – screenshot
◾added old sharing back – screenshot
◾fixed Ad overlapping on Header Style 4
◾fixed translation for Home breadcrumb
◾fixed issue with video thumb downloader (sometimes it did not download the thumb)
◾better megamenu handling on touch devices
◾added comments on pages ( with option in theme panel – default it’s disabled )
◾post views counter alternative for W3 Total Cache (with WP-PostViewer and Ajax_the_view plugins) – https://forum.tagdiv.com/wp-postviews-post-view-counter-alternative-for-w3-total-cache/

V 3.4 – 07 March
◾major improvements to the mega menu. Works with hover on sub-categories
◾major improvements to the ajax system. It’s really fast now 🙂
◾added more source and via
◾added transparent header option in Theme Panel – screenshot
◾added option to switch icons color for Header Menu from Black to White – screenshot
◾added option to switch off the uppercase font on Big Slider/Sliders screenshot
◾fixed sharing style
◾fixed sharing post to open in new window
◾fixed Mega Menu font
◾fixed wp-admin upload file issue on small screens

V 3.3 – 03 March – List of modified files
◾New sharing icons
◾better design for tags at the end of posts
◾better one click import script. Now our demo that is installed locally is more compleate
◾Fixed translation ‘Home’ in the breadcrumbs
◾Added Sub-menu font in Theme Panel -> Custom Typography
◾Fixed MegaMenu color issue
◾Added new pages and categories to demo install
◾fixed some random appearing issue with the menu and category selection on posts
◾we switched the h3 tags to h4 in the mega menu

Balders
tagDiv Member

Hi Marius,

what do you mean by that: “Also for the date can be modified to read the event date instead of the post date, but i’m not sure.”?

Did you sort on your local machine by post date or by event date? I double checked. The sorting with your code goes via post date.

Would you mind double check your settings on your local machine?

Thanks for your time.

Marius
tagDiv Staff

Hi,
I’ve tested locally when I’ve implemented the code for you and work fine for me.
Please can you double check if you make all the steps correctly.

Also for the date can be modified to read the event date instead of the post date, but i’m not sure.

Thanks for your message!

simchris
tagDiv Member

Make sure you’re not in “compatibility mode” in IE10/11 for your website. That mucks with all sorts of things, I found. May not be the issue, but it broke all sorts of things for me. And, if your host uses mod_pagespeed or if you’re using caching be sure to “disallow” your wp-admin and themes folder from being “optimized” or “modified” as that can also break stuff. Mine still works, so usually good idea to backtrack on any new plugin installed which inserts any hooks into the page posts/admin (like a form manager, etc.). Some plugins don’t create unique IDs for their “hooks” and then this breaks other plugins.

Viewing 25 results - 76 through 100 (of 101 total)