Archive for the ‘Wordpress’ Category

Install WordPress From Mac Os X terminal bash/shell/terminal profile function

Sometimes staying on top of the latest version of WordPress can be quite annoying when your testing things locally or rolling out regular wordpress sites. I normally install with .svn but this is a neat little bash script function I threw together to grab the latest version of WordPress and unzip into the current directory through Mac OS X Terminal command.

Open up your

vim ~/.bash_profile

and paste the following code into it.

wp-install(){
	wget http://wordpress.org/latest.tar.gz;
 	tar xfz latest.tar.gz;
	mv wordpress/* ./;
	rmdir ./wordpress/;
	rm -f latest.tar.gz;
}

Now quit and re-open terminal or type ./profile for the changes to take effect.

CD into the desired directory and type wp-install and let magic behold you, you’ll shortly have the latest version of WordPress downloaded and installed.

Install latest version WordPress Mac Terminal command

Nice little one liner for installing the latest version of WordPress through a little mac terminal command.

Create yourself a ~/.bash_profile file and create this function within it.

wp-install(){
	wget http://wordpress.org/latest.tar.gz;
 	tar xfz latest.tar.gz;
	mv wordpress/* ./;
	rmdir ./wordpress/;
	rm -f latest.tar.gz;
}

Here’s to my new theme

As many of you will know when thinking about making your own portfolio website – it’s difficult to choose a theme and a concept or even make one that reflects you. I had the same problem, trust me.

One thing that really helped me get over this hurdle and get focused was looking at the problem I wanted it to solve, which for me was – creating a place for me to share my online life with others, and creating a place for me to continue to reference for years to come.

I realised that what I actually wanted it to be is a place for me, not a place for others to come and see me, in doing so I hope it will be mildly more interesting to the onlooker as it should now not only be a reflection of my thoughts / trials / tribulations but also reflects me and my personality.

Ultimately I decided that I needed this redesign to enable me to share various different types of media forms on my own blog. Formats such as tweets, blog posts, spotify embeds, pictures and links have all been taken into consideration.

Although i’m not quite done yet, i’m happy with the initial improvements (particularly the whizzy spinny logo, made purely in CSS3, nifty eh?).

For those interested:

The site is still backed by WordPress & HTML5 boilerplate.

I plan on making some more additions to the site in the near future.

How to get the wordpress posts parent page information out

In many cases when your working with WordPress you’ll want to assign a specific page template to become the static page. Usually replacing the homepage with a static page as well.

You can do this in WordPress -> settings -> reading.

When you set say ‘Latest News’ to be your posts page you may want to get that out at the top of the loop.

Unfortunately in some cases, you might also just settle with the default template for your Latest News page (index.php) which can make things a little more annoying.

WordPress will fill the loop with your posts rather than information about your page. Making the title of the page unavailable. This little useful snippet of code will help you overwrite that.

<div id="title">
<?php $your_title = get_the_title( get_option('page_for_posts', true) ); ?>
<h1><?= $your_title; ?></h1>
</div>

How to change the default from wordpress email from address

Sometimes you might want to stop WordPress sending emails with the default WordPress email from address.

Usually something like wordpress@domain.com

Often displayed like so: WordPress wordpress@domain.com

There are a few plugins available to achieve this, but personally I don’t relying heavily on WordPress plugins – mainly because dependencies on too many third parties can be annoying.

Particularly when there is not much code needed to achieve the change.

Add the following code to your functions.php file.

add_filter('wp_mail_from', 'replacement_mail_from');
add_filter('wp_mail_from_name', 'replacement_mail_from_name');
 
function replacement_mail_from($old) {
 return 'your email address';
}
function replacement_mail_from_name($old) {
 return 'your name or your website';
}

What tables does wordpress multisite create

Just in case you ever needed to know or ever wondered what tables wordpress multisite creates in your database when you activate your network i’ve compiled the small list below.

WordPress multisite tables

  • wp_1_categories
  • wp_1_comments
  • wp_1_link2cat
  • wp_1_links
  • wp_1_options
  • wp_1_post2cat
  • wp_1_postmeta
  • wp_1_posts
  • wp_blogs
  • wp_blog_versions
  • wp_registration_log
  • wp_signups
  • wp_site
  • wp_sitecategories
  • wp_sitemeta

How To Setup WordPress MU in MAMP on Mac OS X

Again, as is often quite a common occurence on my blog, i’m again blogging something that I think me and my team will find useful in the future. This time it’s setting up a WordPress MU installation on OS X using MAMP.

We needed a WordPress Multisite install locally so that we could test flexibly, privately, and securely throughout the development process for a new project. It’s definitely worth the effort especially if you – like us love developing locally.

Things you’ll need

  • Terminal
  • Editor – vim, nano, mate
  • MAMP installed

Getting started

First lets create a site in /Applications/MAMP/htdocs/ – call it mutest

mkdir mutest
cd mutest

Now checkout wordpress with your favourite version control (we use subversion).

svn co http://core.svn.wordpress.org/tags/3.3.2 .

You’ll see it checking out wordpress now – when it’s done navigate to localhost:8888/mutest/ and complete the WordPress installation, i’m going to assume your competent with installing it normally.

Now open up the MAMP portal and perform the following.

Now go to Ports and change the default port from 8888 to 80 – once you do this mamp will restart and probably prompt you for your admin password.

We’re going to use the subdomain mapping for wordpress rather than the subfolder so next we need to edit the /etc/hosts file (which is on your mac).

I use textmate with the terminal hook, so I fire up terminal and run a command like so.

mate /etc/hosts

You could run vim or any other terminal editor if you like.

Add two new example domains to the hosts file (you will probably add more in the future but two will do for now).

example.site.com
example1.site.com

Save and exit.

Edit your Apache vhosts config file

Open /Applications/MAMP/conf/apache/httpd.conf in a text editor and scroll down to the line that says “#NameVirtualHost *”. Replace that line with the following code:

NameVirtualHost *
<virtualHost *>
 ServerName example.site.com
 ServerAlias example.site.com *.example.site.com
 DocumentRoot "/Applications/MAMP/htdocs/mutest"
 <directory "/Applications/MAMP/htdocs/mutest">
  Options Indexes FollowSymLinks Includes
  AllowOverride All
  Order allow,deny
  Allow from all
 </directory>
</virtualHost>

Save and restart mamp server.

Configuring WordPress MU

WordPress Multisite is really easy to configure just start by adding the following to your wp-config.php file.

define('WP_ALLOW_MULTISITE', true);

Once you’ve done this head to wp-admin backpanel and then look for the submenu ‘Tools’ and click Network.

On this page you will now see an option to use sub-domains for your site addresses. Make sure that’s selected, check the other details, and then click the “Install” button to make it happen. Note that you’ll see a warning message that says, “Wildcard DNS may not be configured correctly!” – we can ignore this warning because we know our DNS is correct.

Finally, complete the steps outlined there on the “Enabling the Network” page (i.e., create a blogs.dir folder and add the required code snippets to your .htaccess etc). After that, re-login to the Admin area and go to Network Admin > Sites > Add New to begin adding your sub-domain network sites.

Your done! It’s all over. Your now rocking a nice little wordpress multisite setup locally. Good job. Grab a coffee and get coding!

I released Topmmorpg100 an MMORPG Topsite

Over the last few months as a bit of a side project I have been developing and building topmmorpg100.com – an online MMORPG, MMO & Browser based gaming topsite voting site.

Game developers and game owners can list their games on topmmorpg100.com for free and encourage their users to vote for them on it. They can make use of our industry leading API’s which provide developers with everything they need to make a successful job of incentivising voting for their players. Our API’s will do such things as callback your API URL when a vote is successfully processed with the playerID you pass to us in the voting process.

It’ll even allow you to verify a userID or IP Address has voted for your game.

Topmmorpg100.com is looking for some more game owners to join, currently they are offering 100 free votes and 1 month free Gold membership to the next 5 sites that join up.

It’s certainly a very good MMORPG & Gaming voting site and is feature rich and well coded.

Come check out my hard work here if you like it, be sure to drop me a comment or buy me a beer sometime. Also if you have any improvements you’d like to see drop them here as well.

WordPress in two sentences

Recently tasked with doing this for work, what is WordPress? Explain in two easily understandable sentences:-

WordPress is web software you can use to create a beautiful website or blog quickly, feature full and user friendly. We like to say that WordPress is both free and priceless at the same time.