[Howto]Restrict admin access to your IP using DNS-O-Matic.

This tutorial will show you how to restrict WordPress logins and the WordPress admin area to only your IP using DNS-O-Matic.

Step 1.

Sign up for a free account at DNS-O-Matic. We will us this to update the IP.
This account is also useful for updating you IP for OpenDNS if you use it 😉

Step 2.
Sign up for a free account at  no-ip and create your free hostname.

Step 3.
Go back to DNS-O-Matic and configure your no-ip username, password and hostname.

Step 4.
Download the DNS-O-Matic update utility then install and configure. I’m using the mac client but there are several clients available, even router options.

Now your almost there. Your update client should have updated your IP to DNS-O-Matic.

Step 5.
Add a new plugin to check your login/admin IP is the same as your no-ip IP.
Create a new php file in wp-content/mu-plugins and add the following:

add_action( 'login_init', 'my_dns_check' );
add_action( 'admin_init', 'my_dns_check' );
function my_dns_check() {
if ( gethostbyname( '## NO-IP HOST HERE ##' ) !== $_SERVER['REMOTE_ADDR'] )
wp_die( 'Your IP is not allowed to access the admin area.', 'ACCESS DENIED!', array( 'response' => 403 ) );
}

Thats it!

[Howto]Restrict admin access to your IP using DNS-O-Matic.

[Howto] Add post-thumbnails to wordpress child themes.

I needed a way of adding post-thumbnails ( featured image in 3.0 ) to my latest theme.

The theme JustCSS is a child theme of Toolbox.

I wanted a way of adding this code to functions.php without editing the Toolbox core files, so updates are still workable.

First thing was to enable featured images by adding the support line to functions.php in my child theme folder.

Now I can go ahead an assign an image to my test post but the image will never show so I needed to add a filter to the_content to add the thumbnail.

Here is the finished code in my functions.php:

[php]
add_theme_support( ‘post-thumbnails’ );
add_filter( ‘the_content’, ‘add_thumbs’ );
function add_thumbs( $content ) {
the_post_thumbnail( ‘thumbnail’ );
return $content;
}
[/php]

The theme will be available on this site soon, and on WordPress.org as soon as child themes are allowed.

[Howto] Add post-thumbnails to wordpress child themes.

[HOWTO] Eircom Netopia and DYNDNS.org

I just learned these routers have a hidden option for updating your dyndns account automatically!

You have to us telnet commands to activate it…

Open Telnet and open 192.168.1.254 (default router address)

Now use these commands to setup dyndns:

>configure
>set dynamic-dns option dyndns.org
>set dynamic-dns ddns-host-name myhostname.dyndns.org
>set dynamic-dns ddns-user-name myusername
>set dynamic-dns ddns-user-password myuserpassword
>save
>quit

Restart your router…wait about 2 mins then check the logs for this:

00:00:00:43 TR-069: ACS URL resolved
00:00:00:43 TR-069: Resolving ACS URL - Retry 0
00:00:00:41 DDNS: Hostname updated. good
00:00:00:37 NTP: Update system date & time
00:00:00:37 Daylight Saving Time enabled
00:00:00:32 DDNS: initializing service
00:00:00:32 ipcp: negotiated TCP hdr commpression off

Enjoy!
[HOWTO] Eircom Netopia and DYNDNS.org