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 ( [...]
Monthly Archive for April, 2010
18 Apr 2010
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; [...]