I had a WordPress site requirement where only logged in users could see the site and it’s contents. I came across this bit of code a few years ago and found it to be helpful. Place it into your functions.php and when a visitor comes along who is not logged in, it’ll redirect them to the wp-login.php page to login. Once logged in, then they can view the site without being blocked. This is an example where it can help keep unwanted visitors away from the content of your site. It’s been working great and I wanted to share it.
I’ve released a new plugin, randomPost. The goal behind randomPost is to keep visitors on your website longer. By having the ability to view random posts, it keeps your visitors engaged and that means they stay on your site longer! Once you install the randomPost plugin, and select the random URL slug you want to use (for example: http://obrienlabs.net/random — where /random is the URL slug), this URL will redirect your users to a random post of yours! I recommend using the word “random” as your URL slug, but the option exists to use any slug you’d like (perhaps the word random in another language). Once configured, add the new URL with the slug to your menu as a custom link. [Read More…]
I have released a new WordPress plugin called Ad Blocking Advisor! If you run a website that has advertisements, your visitors could be using ad blocking software (e.g. AdBlock Plus, uBlock, etc.) that could be taking away your revenue! The purpose of this plugin is to detect if a visitor is using an ad blocker, and if so then put a small notification bar at the top of the site (or anywhere on the site you choose), that asks (or advises) the visitor the please whitelist your site. This notification banner only appears to visitors who are using ad blocking software, and the best part is that it’s not limited to just 1 advertisement service. The plugin adds a small 1 pixel transparent PNG image [Read More…]
Recently I was looking for a snippets plugin for this very site. There’s a bunch out there, but none of them had everything I was looking for. So I set out to write my own. Introducing codeSnips. Here’s some features of codeSnips: Using Custom Post Types, you can quickly create a snippet post Quickly create and embed code snippets on your site using a shortcode Syntax highlighting for 126 programming languages An archive list of all snippets using the Custom Post Type Raw view of the snippet — ideal for copying without formatting Can embed multiple snippets per post Here’s an example of a code snippet run by codeSnips. You can click “view raw” to see the raw version. Here’s another snippet, [Read More…]
When I started playing around with WordPress in 2009, I thought it’d be fun to release a plugin one day. I’ve been playing with PHP & MySQL since about 2002 as a hobby, so I had the experience but I didn’t know the WordPress way of doing things. I had a lot to learn. It wasn’t long after I started in 2009 that I started making my own (private) custom themes, and (private) custom plugins. I let those sit in the background and do their thing for a few years (while I worked on other projects). Recently I was looking for a snippets plugin for this very site. There’s a bunch out there, but none of them had everything I was looking [Read More…]