Author Archive for zeo

11 May 2010

Force WordPress network to use sub-directories

In WordPress 3.0, we have the ability to create a network of sites. But if your install is over 1 month old, the sites in your WordPress network must use sub-domains because of permalink problems with “/blog/” from the main site. This is how you can force the sites in your WordPress network to use [...]

23 Apr 2010

WordPress: Conditional Tags Test

Having trouble identify or determine what conditions that a page matches? Add the following Conditional Tags test snippet to your WordPress Theme’s template file, preferably your Theme’s template sidebar.php file: <?php $conditions = array( ‘is_home()’, ‘is_front_page()’, ‘$wp_query->is_posts_page’, ‘is_page()’, ‘is_single()’, ‘is_singular()’, ‘is_attachment()’, ‘is_search()’, ‘is_archive()’, ‘is_category()’, ‘is_tag()’, ‘is_tax()’, ‘is_author()’, ‘is_day()’, ‘is_month()’, ‘is_year()’, ‘is_time()’, ‘is_date()’, ‘is_paged()’, ‘is_comments_popup()’, ‘is_preview()’, [...]

19 Apr 2010

WordPress: Displays the contents of static page Posts page

By default, if you choose a static Page for Posts page to show your latest Posts, the original content of that Page will not be displayed. This is how you can display the content of the Page along with the latest Posts. Add the following lines to your WordPress Theme’s template index.php file, preferably before [...]

18 Apr 2010

WordPress: Limit posts per page

Choose and add the following lines to your WordPress Theme’s template functions.php file (For example, functions.php file for a Theme named “default” would probably reside in the directory wp-content/themes/default/functions.php): function limit_posts_per_page() { if ( is_category() ) return 2; else return 5; // default: 5 posts per page } add_filter(‘pre_option_posts_per_page’, ‘limit_posts_per_page’); function limit_posts_per_archive_page() { if ( [...]

12 Apr 2010

WordPress [gallery]: Force n Number of Columns

If you use [gallery] shortcode without setting the columns value, the default is set to 3. Some WordPress theme can either fit 3 or more column per row or less. Below is an example to force WordPress [gallery] columns to 2 to any post or page that uses [gallery] shortcode: function gallery_columns($content){ $columns = 2; [...]