Nate Angell
Forum Replies Created
-
Thanks @joneiseman, great sleuthing! I wasn’t expecting you to facilitate changes to documentation, I was just leaving my offer to help here in this public conversation.
Whatever the resting place of how custom attributes work in orderby in shortcodes, my hope would just be that better signals are sent to plugin users what is actually happening so they know what’s going on. Adjustments to documentation and perhaps also to the output of shortcodes that include invalid values could both help.
Thanks for looking at this @joneiseman! For us, the big change was not whether the custom attribute was really affecting the order of results, but that it used to fail gracefully and let results through (which did disguise that it was having no effect), but in some update version started to fail harder and not let any results through. I can see how the harder fail is preferable, but it would have been nice to see a hint in the UX (as opposed to debug notices), or at least in the documentation that custom attributes are not supported in orderby. Our content managers spent cycles trying to figure out what was going on in production (where debug is not turned on) and it took some time to narrow it down to this specific change. Again, I’m happy to contribute to documentation if someone can point me to the right path — eg, is there a git repo to make a pull request against?
You may be correct that the custom attribute never affected the sorting, but failed more gracefully @joneiseman. Thank you for bringing that up!
Until such a capability were added, it might be nice if the documentation made clear that custom attributes are NOT supported in orderby, and/or that the failure when they are was more informative.
If there’s a way for me to make a suggestion for the documentation directly, I’m happy to do that is anyone can point me to the right mechanism to do so.
For anyone looking at this in the future, due to JS issues with _24HSTARTTIME_LOCAL and #_24HENDTIME_LOCAL (see this issue and a workaround) I ended up using the following placeholders to show the timezone just once at the end of event times. Note that this solution requires that the timezone NOT be included in the format at Settings >Formatting > Date/Time > Time Format (I use “H:i” here to format times).
#EVENTTIMES #_EVENTTIMEZONE #EVENTTIMES_LOCAL #_EVENTTIMEZONE_LOCAL
Thank you for the pointer!
Thanks for your help! It solved the initial need and set me off on the right track for another solution!
I guess there is also an undocumented #_EVENTTIMEZONE_LOCAL placeholder, so it seems like one could solve the same need for local times using something like:
#_24HSTARTTIME_LOCAL–#_24HENDTIME_LOCAL #_EVENTTIMEZONE_LOCAL
The only issue is that because of the JS scripting, #_EVENTTIMEZONE_LOCAL results have whitespace around them and so putting characters around the placeholder like:
(#_EVENTTIMEZONE_LOCAL)
displays something like:
( #_EVENTTIMEZONE_LOCAL )
Also, if I’m not mistaken there is already an undocumented #_EVENTTIMEZONE placeholder, so it seems like one could solve the first need here using something like:
#_24HSTARTTIME–#_24HENDTIME (#_EVENTTIMEZONE)
I came up with this as a function to supply a placeholder with just the local timezone. Happy to hear suggestions for improvement!
add_filter('em_event_output_placeholder', function($replace, $EM_Event, $result) { if (preg_match('/#_MYEVENTTIMEZONE_LOCAL.*/', $result)) { $rand = rand(); ob_start(); ?> <span id="em-start-local-timezone-<?php echo $rand ?>">JavaScript Disabled</span> <script> document.getElementById("em-start-local-timezone-<?php echo $rand ?>").innerHTML = Intl.DateTimeFormat().resolvedOptions().timeZone; </script> <?php $replace = ob_get_clean(); } return $replace; }, 10, 3);
Thank you so much! That works great as an alternative for #_EVENTTIMES, although it also includes the timezone on “all day” events, which is unnecessary — I’ve been looking to see if there might be a way around that.
We are also trying to figure out how to do the same thing as an alternative for #_EVENTIMES_LOCAL, but am not quite sure the variable to modify for that placeholder.
I’m wondering if it might not be easier to just create a custom placeholder just for the event timezone and the event local timezone so they could be output independently of the start/end times…
Forum: Plugins
In reply to: [Zotpress] in Zotpress 7.3.10 sortby=dateAdded borks shortcodeSorry, I couldn’t find the right GitHub repo to make a PR in and I don’t speak SVN, so I hope what I added above is helpful.
Thank you so much for your labors on this most awesome of plugins!!!
Forum: Plugins
In reply to: [Zotpress] in Zotpress 7.3.10 sortby=dateAdded borks shortcodeI may have found the issue in line 633 of lib/shortcode/shortcode.functions.php:
$zpr["sortby"] = strtolower(sanitize_text_field(wp_strip_all_tags($atts['sortby'])));
should have “strtolower” removed as “dateAdded” requires the capitalized “A” so it becomes:
$zpr["sortby"] = sanitize_text_field(wp_strip_all_tags($atts['sortby']));
I will submit a PR in GitHub in case that’s helpful.
Forum: Plugins
In reply to: [Zotpress] in Zotpress 7.3.10 sortby=dateAdded borks shortcodeNote: I have tested in 7.3.8 and 7.3.9 and it appears that this issue didn’t arise until 7.3.10.
Forum: Plugins
In reply to: [Semantic-Linkbacks] fatal error on PHP 7.0.30Note: The issue is not theme-specific and appears on other Genesis and non-Genesis themes.