How to limit the number of results for all query_posts on mysite

It is not that hard to enforce a hard limit on results: add_action( ‘post_limits’, function($limit) { $limits = explode(‘,’,$limit); if (isset($limits[1]) && 2000 < $limits[‘1’]) { $limits[1] = 2000; } $limit = implode(‘,’,$limits); return $limit; } ); I would not be surprised if that does not solve your problem though. Just searching over that many … Read more

How to add feature image url in my template file and content as well?

Page’s don’t by default have a “Featured Image”. If you’ve found a plugin to do that, then to output the Featured Image use the following function: the_post_thumbnail() You can read more about it in the WordPress Codex here. There are various other functions that will return the image markup (get_the_post_thumbnail ()), or just the Featured … Read more

Show items by user_role

Here is an easy way to check if a user has a role. Note that I used your way of getting the WP_User, but there are others: $user = new WP_User( $item->post_author ); // $user = get_userdata( get_current_user_id()); // another way to get logged in user if ( !user_can($user->ID,’directory_4′) ) { // show items, user … Read more

Enabling XSendFile causes 404 for images on WordPress Multisite / Network

It wasn’t a .htaccess problem, but an apache configuration problem. On a Mac server you need to: compile XSendFile as a universal binary: apxs -cia -Wc,”-arch i386 -arch x86_64″ -Wl,”-arch i386 -arch x86_64″ mod_xsendfile.c and modify the site specific httpd.conf file in /Library/Server/Web/Config/apache2/sites. If you’re having the same problem, I wrote about this on my … Read more