Converting a site to WP but doing the right SEO stuff
Mainly what you have to do is:
- Convert the site to WP
- Once all is good with WP edit .htaccess
- Above all the wordpress stuff you have to add this type of thing: Redirect 301 /myoldurl.html http://mydomain.com/newpagename
- You have to add that for each old file that you want to redirect to the new file
- There is info all over the net, including here: http://stackoverflow.com/questions/3696002/converting-a-static-site-to-a-wordpress-site-how-to-transfer-convert-seo-ranki
Install WordPress in sub-directory, run in home directory
It’s been a while since I posted. I’ve been a busy bee! This post will be short and sweet.
I work on a lot of existing sites that I’m converting to WordPress. I want to leave the current site in place and work on WP in sub-directory until its time to go live. This link will tell you how to do it:
http://www.optiniche.com/blog/145/wordpress-tutorial-install-wordpress-in-a-different-directory/
That’s it…see short and sweet!
Put wordpress on a site with an existing page.
So I had this site that already had a page up. I needed to install wordpress in the root and make some changes but I didn’t want wordpress to be live to the general public…after asking in 4 forums and not getting help I figure this out. I was thinking I should use .htaccess but I solved this with a stand alone page and a cookie checker added to the themes header.php
Here’s the good:
- Moved my current page from www.site.com to www.site.com/sub/
- Created a page accessible only to me on the site that sets and destroys a cookie in the root directory using something like this:
$action = $_GET['action']; if ($action == "create") { setcookie("dealvilletempcookie123", "yes", time()+(60*60*24*365),"/"); } if ($action == "destroy") { setcookie("dealvilletempcookie123", "no", time()+(60*60*24*365),"/"); } - In the header.php file of the WP theme I check the cookie.
If its set to YES then I do nothing (which opens the WP install in the root directory)
If its set to NO (or not set or set to anything else) then I use the PHP header function to redirect…do this at the very top of the header file, before you load an WP stuff. ITS THE LAW!
Whoop…there it is.
PHP Cookies and WordPress – Set That Path, Brother!
OK I don’t claim to understand this (as so many things I post here) but I figured since I worked this out I would post it!
I am working on a WordPress site and setting a cookie with PHP code. I was running this code:
setcookie("your-selected-location", $the_slug, time()+(60*60*24*365));
The problem is that I was getting odd results and when I checked Firebug in Firefox, looking at the cookies, this ONE line was setting TWO cookies with the same name but for 2 different paths!
Still not sure why, although I think its something about WP, but I fixed it by changing the code to this:
setcookie("your-selected-location", $the_slug, time()+(60*60*24*365),"/");
Which forces just 1 cookie to set for the / path. There it is!
Control the content that shows in WordPress
This is a quick post that assumes you know wordpress.
This gets the content of a page
$content = get_the_content();
This gets and displays the content:
the_content();
I needed to get the content, show only the first paragraph, then display it…so this is what I did:
/* THIS CODE GETS THE FIRST PARAGRAPH ONLY OF THE PAGE CONTENT */ $content = get_the_content($more_link_text, $stripteaser, $more_file); $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); $content = strstr($content, '</p>', true); echo ("<hr>$content<hr>");
There ya go…be about it!
Helpful Tip: Moving a static site to WordPress
I had a bit of delima…I had a current static site that I couldn’t get rid of, but wanted to replace with wordpress. Putting WP in a sub-directory, then moving to the home directory is a nightmare so I couldn’t do that.
Basically what I wanted to do was if someone went to www.site.com they would be redirected to www.site.com/oldsite (where I had moved the current site to). But I needed some people that I’m working with to see the wordpress files in action so if you go to www.site.com/index.php I wanted the wordpress to show…but only if you typed in the fully qualified URL.
I thought this would be an easy set up in .htaccess but either my hosting provider has some behind the scenes stuff going on preventing it or it’s just not easily doable.
After much fighting with HTACCESS, I finally figured out how to do this by going backward with it. Wordpress plugin to the rescue!
So here’s what I did, start to finish:
- Original site at www.site.com, moved it to www.site.com/old
- Installed WordPress at www.site.com
- Change permalinks to a custom structure of /%postname%
- Create a page called WELCOME…in the end this will be my real home page
- Created a page called REDIRECT (you can change your page names)
- Made REDIRECT my home page under SETTINGS in WordPress
- Downloaded this super awesome redirector plugin: http://urbangiraffe.com/plugins/redirection/
- Activated that sucker and set it up to where www.site.com (which is the redirect page, default WP home page) goes to www.site.com/old
- To view the new home page now you go to www.site.com/welcome
When I’m ready for the WP site to go live:
- Make WELCOME my home page in Settings
- Delete REDIRECT page
- Deactive that plugin.
PROBLEM SOLVED…thanks Urban Giraffe for a cool plugin!
Using jQuery UI with WordPress
I am posting this just in hopes of others finding it.
http://elementdesignllc.com/2009/08/wordpress-jquery-is-not-a-function/comment-page-2/#comment-2439
If you have JS code for showing the jQuery UI dialog box (modal window) but the code is throwing an error in Firebug, replace the $ with jQuery or jQuery() as needed.
Recent Posts
- IE, Forms, Image Submit Buttons = Bad Mojo
- A good .htaccess file
- It’s the little things
- Converting a site to WP but doing the right SEO stuff
- 301 Redirect and Canonicalization
Categories
- Android
- Cookies
- CSS
- Droid 2
- FireFox
- General Nerdiness
- God
- HTML
- IE8
- Internet Explorer
- Introduction
- Javascript
- jQuery
- Mexico
- Photoshop
- PHP
- Random Thoughts
- SEO
- Spyware
- Virus
- Web Design
- Win7
- Wordpress
