I work for a group of newspapers here in Iowa. We recently started moving these sites to WordPress. Site visitors must be logged in to view stories. They can see all the stories on the front page, but when they click through to a single story, they see a login form in place of the post/story content.
[ad]
I needed to redirect users back to the page they were viewing after logging in. So, if a user was viewing a story called “Look at me now”, they’d need to be redirected back to that story after logging in.
To achieve this redirect after login, add the following code to the functions.php file for your theme:
I looked at a number of plugins to do this, but none seemed to offer this functionality.
A bit of searching on Google yielded this post at Taproot Creative. I modified the code on that post to set the redirect location to the referring page, and that was it!
Now users are redirected back to the story/post they originated from.
So, I wrote this little thing a couple days ago. I was browsing on Geocaching.com and wanted to decode some of the hints. I found a few ROT13 decoders online, but wanted to write one of my own.
Much to my dismay, I learned geocaching.com has a built-in “decode” link right next to the encoded hints. I didn’t learn about this until about 10 minutes after I had finished writing the Geocaching Hint Encoder/Decoder. Thankfully, I didn’t have more than 20 minutes of work into it, so no big deal.
Google has some seriously nice looking fonts available for you to use for free in the Google Font Directory. All the fonts are under an open source license and are served right from Google servers.
Most modern web browsers support webfonts. The Google Font API FAQ would be a good place to visit if you have questions or are curious about some of the limitations.
Making use of these fonts in your WordPress theme is extremely easy, as long as you have a basic understanding of CSS. Now let’s get down to using these in your WordPress theme, we’ll keep it short and simple.
First, head over to the Google Font Directory and pick a font to use. I’ll be using IM Fell as an example, since that’s the font I use for post titles on this site.
Once you find a font you like, click on it. If the font you chose has variants, you will need to click on a variant to use. Once you’re on the font page, click the “Get the code” tab and google will generate the code for the font. You will embed this code in the header.php file for your theme. I usually put it right before the line that calls the theme stylesheet file. Here’s the code I used to include the IM Fell font:
After that, all you have to do is use the font in your CSS, typically the style.css file in your WordPress theme directory. To get my post titles to use the IM Fell font, I did this:
1
2
3
4
5
.entry-title,h3{
font-family:'IM Fell DW Pica',arial,serif;
font-size:28px;
font-weight:600;
}
The font-size property defines what size of font to use (duh!). The font-weight property defines the thickness of the font (degree of boldness). You can apply the font-family property using the Google Font to pretty much any piece of CSS that targets text. You can use it for post content, links, widget titles, or whatever you want really.
If you have any questions, feel free to leave a comment and I’ll do my best to help you out!