alexsbrown
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: redirect page and mask urlI would also really like to do this as well. I want to have https://www.alexsbrown.com/index.html still appear to be that URL, but to serve up the same result as https://www.alexsbrown.com/. Right now I use the following redirects (plus the DirectoryIndex command to avoid creating problems):
DirectoryIndex index.php index.html Redirect permanent /index.html https://www.alexsbrown.com/ Redirect permanent /index.htm https://www.alexsbrown.com/
All these are in the .htaccess file.
I have other rewrites, and I would love it if WordPress could do something similar. For instance, this one makes “newsletter.html” (not a real web page) appear to be a real web page, serving up my newsletter home page from a cgi script:
RewriteRule ^newsletter.html$ /cgi-bin/mail.cgi?f=list&l=ASB_News [L]
I realize that WordPress somehow detects the incoming URL in the index.php, and slices that apart to figure out where the person was going and what information to send back. I cannot figure out how to feed something new in, so that a URL will get special treatment. I suspect that the environment variables REQUEST_URI and PATH_INFO have something to do with it, so I tried the following:
RewriteRule ^/index\.htm.*$ /index.php [E=REQUEST_URI:blah,E=PATH_INFO:test,L]
That did not work. I put some test code into my main page to echo back the contents of REQUEST_URI and PATH_INFO, and they reflected the URL that I had entered in the browser, not the values in the RewriteRule.
Any ideas on how to trick WordPress into responding to one URL as if it were another?
Forum: Fixing WordPress
In reply to: UTC appears as MST using php ‘T’ time formatFor world-travelers looking for a workaround, you can try what I did. I set the offset in WordPress to zero, so the post_time would ALWAYS be in GMT/UTC time. I then removed the display of the time zone, because it is always wrong. If I wanted to, I could add the string “UTC” to my theme, after the time display, but I have not bothered. I am hoping for a more elegant solution soon.
Also, if anyone thinks that WordPress handles time poorly, take a look at the code searching for ‘gmt_offset’. WordPress generally does a really elegant job handling local and UTC times. Almost everywhere the time is adjusted properly. These display functions are rare exceptions.
Forum: Fixing WordPress
In reply to: UTC appears as MST using php ‘T’ time formatI have a similar problem. I want to show the WordPress time zone next to my post’s time stamps. If I use ANY of the PHP time-zone abbreviations (e, I, O, P, T, or Z), they reflect the SERVER’s local time zone. Changing the offset in the WordPress control panel does nothing.
I have also discovered that the time/date shown for each post corresponds to the post_date for the item, not the post_date_gmt.
For most users, this is a good thing. If they posted at 6 pm their local time, they want to see “6:00 pm” next to their post. If they move three time zones away and reset their WordPress time-zone settings, they do not want to see the post time change to “3:00 pm” for that same post. None of them use the time-zone display settings, so they are unaware of the underlying incorrect date/time.
I travel all over the world, though, and I LIKE the idea of having my post times change depending on how I set the offset in WordPress. I really do want my post date/time to be based on the GMT value (post_date_gmt), not the local post_date.
I can make out a little bit of what is going on in the_date functions in general-template.php. I can see that there is a $gmt option for get_post_time, but I do not see any way of passing it through from the_date or the_time.
Is there any way to get the real, GMT date/time for a post, so I can display it in my custom theme? What would I replace the normal “the_date” or “the_time” calls with to make it work? I have looked, and do not see a hack or a combination of functions to make it work. I suspect that I could create my own function based on the_date, the_time, get_the_time, and so on, but I am not 100% sure how.
I also help this post sheds some light on the problem that shrapnel faced. When WordPress builds the date/time it is not really building a correct GMT/UTC based date/time. It is taking the post_date, which was adjusted correctly to account for the local time of the person posting it, then sticking it into the server’s local time zone. If you use one of the PHP date/time flags that show the time zone, then you see the problem right away.
Any ideas?