Archive for the ‘Uncategorized’ Category

Exclude Individual Pages From WordPress Searches

Posted on July 21st, 2010 in Uncategorized | No Comments »

There is plenty of information on how to exclude certain categories from WordPress Searches but it is very hard to find anything on how to exclude individual posts or pages from the search results. All you need to do is add a search filter to your functions.php file in your WordPress theme that looks like this:

function searchFilter($query) {
  if ($query->is_search) {
    $query->set('post__not_in', array(13,14,15));
  }
  return $query;
}
add_filter('pre_get_posts','searchFilter');

Just change 13,14,15 to whatever page (or post) ids you would like to exclude from the search. Do not put the numbers in quotes.

ImageMagick + Gimp + PNG Offset Trouble

Posted on August 5th, 2007 in Uncategorized | 4 Comments »

I have a custom little utility that I wrote that uses ImageMagick and Zenity to take a screen shot. I have the script hooked up to Z keyboard command. This is the bash script.

#!/bin/bash

fn=$(zenity --entry --title='File Name' --text='File Name Prefix');
dt=`date '+%Y%m%d'`;
screenshot="/home/USERNAME/Desktop/$fn-$dt.png";
import -frame +repage $screenshot;

Be sure to change USERNAME to your actual username so the path to your desktop will be correct. Also, for the sake of your sanity, please note the +repage switch that we pass to ImageMagick’s import command. Without that, Gimp will be very unhappy with the offset of the PNG. The layer will appear outside of the image and you won’t be able to see your screen shot in Gimp. If you happen to have that problem already, you can zoom out in Gimp, then use the move tool to drag your image back into view.

The screen shot utility, when invoked, will first prompt you for a little file name prefix using zenity. That prefix will have a date appended to the end of the saved file name. So, for example, if you ran this script today and typed in “receipt” as the file name prefix, the final saved image will be named “receipt-20070804.png” since today is August 4th, 2007. After typing in your file name prefix, you will see a + style cursor. Either click on a window or click and drag a selection on your screen to take the screen shot. The sreen shot will be saved to your desktop.

Get Adobe Flash playerPlugin by wpburn.com wordpress themes