We are on the cusp of launching the first of many practical utility apps that will aim to increase productivity by streamlining efficiencies. Promtr is currently submitted to Apple for review and anticipation is building for its release.
In this article, we’re going to discuss how you can effectively use permalinks & pagination with Custom Post Types in WordPress 3
Using Custom Post Types are a great way to segment different types of content for building large sites. Basically, a CTP is like a “blog post” with its own set of “posts” and “categories”. Have you ever wanted to just duplicate the blog “posts” and call it something like “portfolio” or “library”? Custom Post Types to the rescue!
We’ve been using CTP’s in almost every WordPress site we develop. I’ve ran across one issue that I haven’t been able to resolve until recently. If you have your permalink settings set to /%postname%/, you might have an idea as to what might be going wrong.
Heres the issue: Using pagination with CTP’s while permalinks are set to “postname” will render out 404 error once you goto the next page of the CTP. Until recently, my “fix” was to simply turn off “pretty urls” for all custom post types, rendering your URLs something like this (post_type=portfolio&page_id=886) Which is not very NOT pretty at all.
The latest version available at the time of this tutorial is: 20100729 (I used the 64-bit version, the install process is the same as the 32-bit version)
First take a look at the phpinfo screen and notice the powered by zend logo
Let’s start by putting the zendDebugger.so in the proper directory
Step into: /Applications/MAMP/bin/php5.3
Create a zend folder in the php5.3 directory
/Applications/MAMP/bin/php5.3/zend
Step into the newly created zend directory and create a debugger folder
I named my folder using: zendDebugger-{versionNumber} as the name structure
I named the folder accordingly: ZendDebugger-20100729
Open and extract the compressed file downloaded from zend.com
Locate the 5_3_x_comp folder and copy or move the ZendDebugger.so to the new folder we just created
Today I’m going to show you how to force a www and a non www domain using htaccess.
It’s common knowledge that you can access your site with or without the www. By not forcing one or the other this will penalize your SEO, due to duplicate content. The most common method of doing this is via .htaccess using mod_rewrite.
When I was first learning how to use .htaccess this was one of the simpler methods to find examples of with any search engine. Now, if you are only needing to edit your. htaccess for one domain, the majority of these found examples will suffice; If you have multiple domains that tend to go to one directory this example will be much more beneficial. Also, if you put this example into your httpd.conf file, this can take effect on all domains on the server; so you won’t need to worry about adding each domains redirect.
I have provided the below examples as a method I use to manage redirects. I have provided an example for each method, www and non-www.
In order for mod_rewrite to work you must first enable it. This is easily done by adding this to the .htaccess.
RewriteEngine On
Force www:
# Do a www redirect on the domain
RewriteCond %{HTTP_HOST} !^www\.[a-z-]+\.[a-z]{2,6} [NC]
RewriteCond %{HTTP_HOST} ([a-z-]+\.[a-z]{2,6})$ [NC]
RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]
Force non-www
# Do a non-www redirect on the domain
RewriteCond %{HTTP_HOST} ^www\.[a-z-]+\.[a-z]{2,6} [NC]
RewriteCond %{HTTP_HOST} ([a-z-]+\.[a-z]{2,6})$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
How this works:
When the URL is being received we check it to ensure it is valid to our method of choice. Regardless of our method, it checks the URL to see if it matches, checks if the URL contains the www or not. Next it will set the conditional variable to be used in the actual redirect.