I know you've all been wonder where I've been and what I've been doing.
Over the past few months, I've been investigating WordPress as a blogging platform and have implemented it as the engine behind a financial news website. I've developed a couple of plugins and widgets for it, and there's some pretty good stuff that the WordPress folk are still putting in.
In other news, to get my blog running on the WordPress engine, I've taken up a commercial hosting package and so am no longer blogging here. You can access my new blog at: http://www.nitinkatkam.com/blog
Tuesday, July 21, 2009
Tuesday, April 28, 2009
WordPress: Disable Canonical URL Redirection Plugin
If you've got WordPress redirecting the browser to a URL, only to cause Apache (or whatever you are running as a web server) to redirect back to the original URL, you've got to disable the canonical URL redirection in WordPress. You can do this by saving the following to a PHP file in the plugins directory and activating it via WordPress.
<?php
/*
Plugin Name: Disable Canonical URL Redirection
Description: Disables the "Canonical URL Redirect" features of WordPress 2.3 and above.
Version: 1.0
Author: Mark Jaquith
Author URI: http://markjaquith.com/
*/
remove_filter('template_redirect', 'redirect_canonical');
?>
<?php
/*
Plugin Name: Disable Canonical URL Redirection
Description: Disables the "Canonical URL Redirect" features of WordPress 2.3 and above.
Version: 1.0
Author: Mark Jaquith
Author URI: http://markjaquith.com/
*/
remove_filter('template_redirect', 'redirect_canonical');
?>
Changing my WordPress blog domain
The WordPress guys and my co-worker who made some mods on it made it difficult to move our blog from the staging environment to the production environment. As the domain name is different, I had to fix up the post GUID links using string replacement in the PHP file, as I didn't want to change the database on the live site (our PHP files are version controlled, but the data on the DB server is not). I did have to change the URL in the options table in the DB for 2 rows 'cos WordPress would always redirect me to the staging environment's domain name.
After getting the blog all patched up, I finally did a Google search to figure out how other WordPress bloggers moved their blogs, which brought me to this article:
http://codex.wordpress.org/Changing_The_Site_URL
After getting the blog all patched up, I finally did a Google search to figure out how other WordPress bloggers moved their blogs, which brought me to this article:
http://codex.wordpress.org/Changing_The_Site_URL
CSS: Center Aligning Text Vertically - Method 3
Another approach to vertically centering text is to change the display property of the container to table-cell and add the vertical-align property with the value middle. This method does not work with MS Internet Explorer.
Example
div#header {
vertical-align: middle;
display: table-cell;
height: 200px;
background-color: yellow;
}
<div>
My text
</div>
Example
div#header {
vertical-align: middle;
display: table-cell;
height: 200px;
background-color: yellow;
}
<div>
My text
</div>
CSS: Center Aligning Text Vertically - Method 2
You can center text vertically by using absolute positioning on the child element and setting the top property to 50%. You might have to adjust the margin-top attribute to get the text exactly in the center.
Example
div#header {
position: relative;
height: 200px;
}
div#header span {
position: absolute;
top: 50%;
margin-top: -10px;
}
<div id="header">
<span>My text</span>
</div>
Example
div#header {
position: relative;
height: 200px;
}
div#header span {
position: absolute;
top: 50%;
margin-top: -10px;
}
<div id="header">
<span>My text</span>
</div>
Subscribe to:
Posts (Atom)