Posts Tagged blog

My own referral…?


Funny story… at least I thought it was… I was on-site @ a customer’s data center the other day and I was tasked with configuring a SUN LTO-3 Quantum tape drive, similar to the photo on the left here, among other things… No biggie right…? Any way… in my usual way I was Googling lots of stuff, because I don’t remember anything… and while doing so, I came across my own blog, this very one you are reading for the answer.¬† I thought that was awesome… I answered my own question… LOL ūüôā

, , , ,

Leave a comment

WordPress Automation


OK so I had a few minutes to spare today and I¬† decided to finalize this mini-automation script for WordPress installs.¬† Keep in mind that¬† the assumption is made that you have used Virtualmin to create the preliminary aspects, vhost, mysql, doc root, etc… If not… this ain’t gonna work as it is.¬† I guess I could work up a more in-depth script to include these aspects, in fact that is how I started this idea in the first place, but the aspects of virtualmin really are pretty extensive and since I am using that to manage the vhosts anyway I just skipped that part, I mean why try to improve on a great integration aspect, besides it is unlikely I could do it better anyway.¬† I would however like to translate this piece into a Perl mod to be added to the virtualmin GUI, that would be a cool improvement.

#/bin/bash

#

echo “Make sure you have created this VHost using virtualmin FIRST…”

sleep 5

echo “OK… moving on then”

sleep 2

echo “Enter the name of your new site, then press [ENTER}”

read newblog

# You need these if you are NOT using virtualmin FIRST !!

# mkdir /var/www/html/$newblog

# useradd -c ‘$newblog user’ -p ‘$newblog’ $newblog

# chown -R $newblog:$newblog $newblog

cd /home/$newblog/public_html

wget http://www.wordpress.org/latest.tar.gz

tar xzf latest.tar.gz

rm -Rf latest.tar.gz

mv wordpress/* .

rm -Rf wordpress

chmod 777 .

# Link the themes & plugins from the default repo

# This makes the assumption that you actually HAVE a repo for themes and plugins…

# If you don’t this ain’t gonna do what we need it to !!

cd /home/$newblog/public_html/wp-content

mv themes bak.themes # <– Just in case we hose everything ūüė¶

# Make the link directorie(s), if necessary and link ’em up

mkdir -p /var/www/repo/themes

ln -s /var/www/repo/themes /home/$newblog/public_html/wp-content/themes

mv plugins bak.plugins

mkdir -p /var/www/repo/plugins

ln -s /var/www/repo/plugins /home/$newblog/public_html/wp-content/plugins

cd ../

cp wp-config-sample.php wp-config.php

#

#

# Final directions

# Open the editor if needed but SED will do what you need

# vi wp-config.php

sed -i ‘s/putyourdbnamehere/’$newblog’/’ wp-config.php

sed -i ‘s/usernamehere/’$newblog’/’ wp-config.php

sed -i ‘s/yourpasswordhere/’$newblog’/’ wp-config.php

chown -R $newblog:$newblog *

# EOF

If you need webmin/virtualmin/cloudmin (I HIGHLY recommend them) you can spin this off:

# Virtualmin/Webmin/Cloudmin Installation

# cd /usr/src

# wget http://software.virtualmin.com/gpl/scripts/install.sh

# sh install.sh

# wegt http://cloudmin.virtualmin.com/gpl/scripts/cloudmin-gpl-redhat-install.sh

# sh cloudmin-gpl-redhat-install.sh

And that’s it! Just navigate to your new URL (assuming that you made the proper DNS entries…) and configure WordPress from its admin console.¬† I also thought this tutorial on SED was pretty useful although what I used here is very basic, just in case you need something more.

http://www.grymoire.com/Unix/Sed.html

Happy Blogging ūüôā

, , , , , , , , , ,

3 Comments

Where things are in WordPress


In my initial struggles with WordPress, namely the PHP that I am not versed in… I was going a little bonkers. Where do things go? I was using a nice editing/design suite, Artisteer, but that still didn’t get me where I was trying to go with logos and such.¬† Ok so maybe I was looking @ doing some heavy customization, that isn’t applicable to a basic blog, BUT… that is what I wanted to do.¬† So you surely have seen the dashboard for WordPress, right? LOL … I decided to just whack away @ the PHP code until I figured out where it was going and how it would affect my page(s)/design(s).¬† For me the command line is how I work best and it is basically instant for changes so I would suggest having a browser open on your site/page and dive in using SSH to the root of your wordpress theme files. This is one of my favorite themes, Bloxy Two:

[root@centOS54 bloxy-two]# pwd
/var/www/html/wordpress/wp-content/themes/bloxy-two
[root@centOS54 bloxy-two]# ls -l
total 192
-rw-r–r– 1 root root¬†¬† 233 May 22¬† 2009 404.php
-rw-r–r– 1 root root¬† 3510 May 22¬† 2009 archive.php
-rw-r–r– 1 root root¬† 3783 May 22¬† 2009 comments.php
-rw-r–r– 1 root root¬† 1141 May 22¬† 2009 footer.php
-rw-r–r– 1 root root¬† 2969 May 22¬† 2009 functions.php
-rw-r–r– 1 root root¬† 3017 Mar¬† 4 16:43 header.php
drwxr-xr-x 2 root root  4096 Feb 19 20:21 images
-rw-r–r– 1 root root¬† 1750 May 22¬† 2009 index.php
-rw-r–r– 1 root root¬†¬† 704 May 22¬† 2009 page.php
-rw-r–r– 1 root root 64078 May 22¬† 2009 screenshot.png
-rw-r–r– 1 root root¬†¬† 532 May 22¬† 2009 searchform.php
-rw-r–r– 1 root root¬† 1380 May 22¬† 2009 search.php
-rw-r–r– 1 root root¬† 2127 May 22¬† 2009 sidebar.php
-rw-r–r– 1 root root¬† 2652 May 22¬† 2009 single.php
-rw-r–r– 1 root root 10398 May 22¬† 2009 style.css

So being in this root theme directory, you can now make changes to all of these files using your favorite editor.¬† It is worth mentioning (I really shouldn’t have to though) that the wp-admin page provides you with the ability to edit these same files.¬† OK, now although it may seem straight forward, this part may or may not be.¬† It depends entirely on how the Author created the template/theme.¬† For example, the footer.php file my not even exist?? Say what?? LOL No worry, you can always create it, but first get to know the theme and how it works.¬† The best way to do that, if you are not PHP savy, would be to just start making some basic changes to see how it all works.

A good point of note here would also be to take a look at the /images dir under your theme root. This can be quite revealing in terms of the layout; i.e. what was created with Photoshop and what is based on just background colors and texture simulations.

So in keeping with the footer, lets take a look @ it shall we?  Honestly, most of it means nothing to me.. and most of it you can just leave alone.  I wanted to add some navigation to the file so here we go trying. I ended up with this:

<p>
<a href=”http://annlee-entertainment.com/”>Home</a&gt; | <a href=”http://annlee-entertainment.com/?page_id=1″>News</a&gt; | <a href=”http://annlee-entertainment.com/?page_id=6″>Contact Us</a> | <a href=”http://annlee-entertainment.com/?page_id=23″>Terms of Use</a> | <a href=”http://annlee-entertainment.com/?page_id=25″>Trademarks</a&gt; | <a href=”http://annlee-entertainment.com/?page_id=38″>Privacy Statement</a><br /><br> <font color=#000000>Copyright &copy; 2010 <?php bloginfo(‘name’);?> Entertainment, LLC. All Rights Reserved</font></p><br>

Which renders as this:

Which was exactly what I was looking to do. See not so bad.¬† The funny thing is that this code, as I am sure you can see, is HTML not PHP.¬† LOL… What took some time was figuring out where to put it, and how to format the HTML, cause I don’t really know that very well either… (What am I doing designing websites???) Who knows… All this took was a bit of time and playing around with formatting to get it exactly as I wanted. Trial and error. Basically, well not basically, exactly, this is a theme that someone else made/designed and with a bit of playing I was able to determine where they put things and then I changed them to suit my needs.¬† The logo on top was a bit more difficult to say the least.¬† Well I had to design it first, which I am not really versed in Photoshop… (damn, what do I actually know how to do here???) but in any event I created a cool logo and now I want to plop it somewhere on top of the header, where it belongs…

As you can imagine, this is in fact the header file.¬† I said what i did above because in playing I have found that the logos don’t always go in the header, especially if one is not present in the design. One theme I was messing with actually used the comments in the header space. So just be sure to understand your design before you start editing files.¬† So this is what I ended up with for a header.php edit:

<!– Testing point here for logo graphics –> <– This is the ‘comment out’ syntax in PHP… <!– all commented out between these characters–> so I moved this closer around a lot while testing.

<div id=”header”>
<div id=”sitetitle”><h1><a href=”http://annlee-entertainment.com/”><img title=”Annlee Entertainment, LLC” src=”http://annlee-entertainment.com/wp-content/uploads/2010/02/annlee11.png&#8221; alt=”” width=”500″ height=”190″ /></a></h1></div>

And again, here is what was rendered:

You can go take a look @ the whole site in larger view to get a better idea… But here is the whole layout:

The logo on the right is just a widget with the HTML text pointing to the .png file on the server. Nothing big there. So anyway… This should at least get you started as I did in customizing some pre-built themes and/or your own themes outside of the design suite.¬† Enjoy…

, , , , , , , , ,

Leave a comment