371 Lotus blogs updated hourly. Who will post next? Home | Downloads | Events | Jobs | Twitter | Bookmarks | Pods | Forum | Blogs | Search | myPL | About 
 
Latest 7 Posts
Increasing the number of posts per page on category, tag, and archive pages in WordPress
Thu, Aug 18th 2011 199
Zero day vulnerability in many WordPress themes
Wed, Aug 3rd 2011 90
WordPress XML Sitemap Plugin Review
Tue, Aug 2nd 2011 146
How to display nicely formatted PHP code in a WordPress post
Thu, Jul 21st 2011 146
Updating Price PHP print statements in Ubercart
Tue, Jul 19th 2011 100
How to dynamically set Facebook Opengraph Meta tags in WordPress headers
Fri, Jul 15th 2011 190
Theming fields in Drupal 6
Wed, Jul 6th 2011 79
Top 10
How to create a MySQL Workbench connection to Amazon EC2 server
Wed, Oct 6th 2010 612
Installing Amazon RDS Command Line Toolkit on Ubuntu 10.04
Wed, Apr 27th 2011 266
Increasing the number of posts per page on category, tag, and archive pages in WordPress
Thu, Aug 18th 2011 199
How to dynamically set Facebook Opengraph Meta tags in WordPress headers
Fri, Jul 15th 2011 190
Drupal Custom Breadcrumb visibility PHP code
Mon, Nov 8th 2010 170
Newer version of Elasticfox now available
Wed, Apr 20th 2011 157
How to display nicely formatted PHP code in a WordPress post
Thu, Jul 21st 2011 146
WordPress XML Sitemap Plugin Review
Tue, Aug 2nd 2011 146
Review of publicly available Drupal stack Amazon AMIs
Mon, Feb 14th 2011 136
How to format line breaks in custom fields in WordPress
Wed, Jul 6th 2011 135


Increasing the number of posts per page on category, tag, and archive pages in WordPress
david    

In WordPress, you can set the number of pages to display per page in the Administration settings. This is set in Admin/Settings/Reading.

The issue with this is that this is a global setting. If you would like to set a different number of posts to display on the front page than on the category page, you can do it by adding this code to functions.php in your theme.

The following code displays 20 posts per page on all pages that are not the front page (index). This includes search results, categories, tag pages, archives, and author listings.

function change_number_of_posts($query) {
	if ( ! is_front_page()) // Make sure it is not the front page
	$query->query_vars['posts_per_page'] = 20; // Change 20 to the number of posts you would like to show
	return $query; // Return our modified query variables
}
add_filter('pre_get_posts', 'change_number_of_posts'); // Hook our custom function onto the request filter

You can change this only for category pages for example with this code.

function change_number_of_posts($query) {
	if ( $query->is_category ) // Make sure it is a category page
	$query->query_vars['posts_per_page'] = 20; // Change 20 to the number of posts you would like to show
	return $query; // Return our modified query variables
}
add_filter('pre_get_posts', 'change_number_of_posts'); // Hook our custom function onto the request filter

The result is that you can set the global setting in the WordPress admin page to 10 posts, which affects the front page (index). You can then insert this code into functions.php and all other pages will display 20 posts.

Note: You do not have to modify your theme other than functions.php for this to work.



---------------------
http://domino.symetrikdesign.com/2011/08/18/increasing-the-number-of-posts-per-page-on-category-tag-and-archive-pages-in-wordpress/
Aug 17, 2011
200 hits



Recent Blog Posts
200


Increasing the number of posts per page on category, tag, and archive pages in WordPress
Thu, Aug 18th 2011 12:10a   David Killingsworth
In WordPress, you can set the number of pages to display per page in the Administration settings. This is set in Admin/Settings/Reading. The issue with this is that this is a global setting. If you would like to set a different number of posts to display on the front page than on the category page, you can do it by adding this code to functions.php in your theme. The following code displays 20 posts per page on all pages that are not the front page (index). This includes search results, categori [read] Keywords: admin administration domino archive
90


Zero day vulnerability in many WordPress themes
Wed, Aug 3rd 2011 10:24a   David Killingsworth
Mark Maunder announced a zero day vulnerability in many WordPress themes yesterday here on his blog. If you use any third party WordPress themes, you should check your server for the presence of timthumb.php or thumb.php. It is reported that several theme marketplace websites host common legitimate themes that utilize this library. The fix is to remove any allowed sites from the thumb.php or timthumb.php files as recommended below. BEFORE: $allowedSites = array ( 'flickr.com', 'picasa.com [read] Keywords: domino blogger server
146


WordPress XML Sitemap Plugin Review
Tue, Aug 2nd 2011 6:11p   David Killingsworth
I have been building quite a few sites with WordPress lately. WordPress has quite a long list of 3rd party plugins developed for various tasks and functions. One downside to this is that there are several redundant WordPress plugins for common tasks, and their plugin search mechanism which is located at http://wordpress.org/extend/plugins/ is somewhat difficult to use. I tend to search for the most installed or popular plugins and use the hive mind’s collective research to choose which plu [read] Keywords: domino bug community database google skype xml
146


How to display nicely formatted PHP code in a WordPress post
Thu, Jul 21st 2011 12:11a   David Killingsworth
I’ve been struggling for a while about how to embed PHP, HTML, or CSS code into WordPress posts so that they look good and are easy to understand. I found this list of 12 WordPress Plugins to Display and Highlight Code. I researched a few of them and finally settled on SyntaxHighlighter Evolved, which was simple to install, easy to use with short codes, formats nicely, and seems to have a large existing user base. In your posts, you can simply use [php] and [/php] shortcodes around your ac [read] Keywords: domino css
100


Updating Price PHP print statements in Ubercart
Tue, Jul 19th 2011 12:11a   David Killingsworth
Recently, I updated an Ubercart shopping cart system on Drupal that was very out of date. After the upgrade, the list price on the product pages had too many zeros. It looked like this. MSRP $ 49.99000 After a bit of research, I learned that Ubercart has been updated to include more decimal places to accommodate more International currencies. I took a look at the node-product.tpl.php template and found that the print statement for the list price was using the out of date print statement. The old [read] Keywords: domino
190


How to dynamically set Facebook Opengraph Meta tags in WordPress headers
Fri, Jul 15th 2011 7:14a   David Killingsworth
I recently developed a WordPress website where it was important that some pages could be liked and show up on a user’s Facebook status. The front page also had a Facebook fan page like box. This is getting to be pretty much the standard for most websites. Setting up the placement of the buttons is pretty trivial. This guide shows you how to generate the widget code for the fan page like box, and this guide shows you how to generate the widget code for the like/recommend button. Embedded th [read] Keywords: admin domino css facebook profile widget




79


Theming fields in Drupal 6
Wed, Jul 6th 2011 11:14p   David Killingsworth
I needed to figure out how to theme a field in Drupal 6. The use case was that I wanted to field to be a URL. This is pretty simple and straightforward by using the CCK Link module, which is a sub-module of CCK. I was able to input my URL, such as http://www.symetrikdesign.com with no problem, and the CCK display options are pretty good. However, I wanted to strip the “http://” part on the output display, but have the link remain the legitimate link of http://www.symetrikdesign.com [read] Keywords: admin domino google
70


Getting the Delicious bookmarks add-on to work with Firefox 5.0
Wed, Jul 6th 2011 10:14p   David Killingsworth
I figured out a simple trick to make the Delicious bookmarks Firefox add-on work after upgrading to Firefox 5.0. This assumes that you previously had the Delicious bookmarks add-on working in Firefox 3.6.x and you have just upgraded to Firefox 5.0 – which disables the add-on and states that it is incompatible with Firefox 5.0 Open Firefox Goto “Help” in the Menu, then “Troubleshooting Information” Click on the “Open Containing Folder” or “Show in [read] Keywords: domino application firefox
135


How to format line breaks in custom fields in WordPress
Wed, Jul 6th 2011 7:13p   David Killingsworth
I was working on a WordPress project where I needed to create some custom fields and format them for the user. I wanted to be able to create those fields so that the user only had to put a few bits of text into the fields and be done with it without having the need to know any HTML formatting. I had this working fine for two fields called price and dimensions. The issues was that the output is a line of text, so all of the items were being displayed on one line and then wrapping to the next line [read] Keywords: domino
74


Fun Fact: How Lotus Notes got it’s name
Mon, Jun 27th 2011 6:09p   David Killingsworth
Mitch Kapor got the name for his company from “The Lotus Position” or “Padmasana”. Kapor used to be a teacher of Transcendental Meditation of Maharishi Mahesh Yogi. [read] Keywords: domino lotus notes




Created and Maintained by Yancy Lent - About - Blog Submission - Suggestions - Change Log - Blog Widget - Advertising - FAQ - Mobile Edition