astrowhiz
Forum Replies Created
-
Forum: Plugins
In reply to: [This Day In History] Table sorting 3.8.1Hi,
Thanks for your reply. Yes the order by length… code does sort chronologically, I was on the wrong lines with that.I still have a problem where $period_days never evaluates to false however, so the IF statement on line 140 always goes to the ELSE.
I can trigger $period_days to false by amending line 131 to –
$period_days = abs(intval($period_days)) < 100 && abs(intval($period_days)) > 0 ? abs(intval($period_days)) : false;
Forum: Plugins
In reply to: [This Day In History] Theme and widgets when info pulled from databaseThanks for the reply. That’s great I’ll have a look at that template.
Cheers
Forum: Plugins
In reply to: [This Day In History] Table sorting 3.8.1Ok so I think the code I posted previously does sort chronologically, it’s just that the previous code is skipping the IF and going to the ELSE
The code here line 131 –
$period_days = abs(intval($period_days)) < 100 ? abs(intval($period_days)) : false;Sets period_days value, which is later tested for falseness. I think the problem is period_days is taking a default value (maybe 0) and so doesn’t get set to false, even if period_days isn’t declared in the shortcode.
I’ve been able to trigger chronological sorting by setting period_days=101 in the TDIH shortcodeForum: Plugins
In reply to: [This Day In History] Table sorting 3.8.1Just to follow up on this could I request Brokencrust have a look at the sorting code in TDIH_shortcodes starting at line 142.
I think this is the default code that should sort chronologically –
ORDER BY LENGTH(p.post_title) DESC, p.post_title ASC
Unless I’m missing something this won’t sort as intended as the field is VarChar I think. The 2nd option in the ternary sorts D-M-Y and the code after the Else sorts M-D-Y.
It would be useful, for me anyway, to have the default be chronological.Cheers
Forum: Plugins
In reply to: [This Day In History] Table sorting 3.8.1So I’ve changed this php in the tdih_shortcodes file –
if ($period_days === false) {
$order = $order_dmy === false ? ‘ ORDER BY LENGTH(p.post_title) DESC, p.post_title ASC’ : ‘ ORDER BY SUBSTR(p.post_title, -2) ASC, SUBSTR(p.post_title, -5, 2) ASC, LEFT(p.post_title, LENGTH(p.post_title) – 6) ASC’;
}
else {
$order = ‘ ORDER BY SUBSTR(p.post_title, 1, 4) ASC, SUBSTR(p.post_title, 6, 2) ASC, SUBSTR(p.post_title, 9, 2) ASC, p.post_content ASC’;
}I’ve taken out all order_dmy references in the table shortcodes and this now sorts tables in correct chronological order. I’m not sure why the IF is defaulting to the ELSE statement though.
I do remember now that I had to change the code before but forgot with the new updates.
Forum: Plugins
In reply to: [This Day In History] What is the minimum PHP version required?@pawwel
Haha, thanks. I hadn’t realised I’d used the word pretty in a different meaning. English is weird. Hopefully the site looks ok though.The project is kind of on hold at the moment tbh, what with the virus lockdown. The history is quite specific to the area I live in so quite niche really.
@cpclemens
Great site. I learned a lot about New York state. There must be tons of history relating to New York. I’m trying to fill all 365 days with facts but it’s a bit of a struggle with my topic.Forum: Plugins
In reply to: [This Day In History] What is the minimum PHP version required?My site uses TDIH pretty extensively
pontefractsandalcastles.org.uk
It uses the TDIH footer widget to display today in history text. There’s also a yesterday, today and tomorrow in history page. All history events are then organised by month or century and displayed in TDIH tables. I’ve altered some PHP in TDIH_shortcodes related to column headers and sort order just to suit my preferences.
The PHP I’m running is 7.3. I guess if at all possible try and upgrade your PHP as I could foresee running into other problems with plugins etc later.
Forum: Plugins
In reply to: [This Day In History] Image caption and date format in tablesI found a workaround for the date display. I just edited the tdih-shortcodes.php to have different column titles, with the Date one being a bit wider.
Just have to remember to amend when the plugin updates.Forum: Plugins
In reply to: [This Day In History] Bulk action and simple import csv problemI solved the import problem by using WP All Import plugin.
I think it’s cos it can mark events as published rather than draft.It also has an import manager so you can bulk delete previous entries imported from that page.
The only limitation I’ve found is that it doesn’t seem to pick up event type, but there is an option in the import wizard to put this in manually for all entries imported. This works ok for me as I usually import event types separately.