Posts Tagged auto

How to disable wordpress autoformatting (
and

tags)

I posted a few days ago about how to prevent wordpress from inserting <br \> and made a note that I would have to do a bit more research to figure out how to disable the <p>’s .  Well a bit more research later I’ve found the solution to getting rid of all the bloody tags that WP throws in there.

What you need to do is to go into your wp-content/plugins directory and either create a new directory and copy the following into a .php file or simply put this into a file into the plugins directory:

<?php
/* Plugin Name: WP Unformat
* Plugin URI: http://wpvibe.com
* Author: Jonathan Dingman
* Author URI: http://jonathan.vc
* Version: 1.0
* Description: Disables the <p> that is automatically inserted by WordPress
*/

remove_filter(‘the_content’, ‘wpautop’);

?>

Of course credit is due to Jonathan Dingman for writing this simple little ditty, but I can say it works great!  Also you should undo any edits to the formatting.php file if you want to use the above

Tags: , , , , , ,

How to Prevent wordpress from automatically inserting
tags everywhere

One of the more annoying features of wordpress is it’s need to auto-format all of your html to high hell, especially when you are importing posts in html format.  Everytime you have a line break WP will put a <br \> in there, screwing everything up.

There are a few plugins around to turn this off however the ones I tried didn’t do jack so I had to go into the wp-includes/formatting.php file and specify that I like my html the way it is thank you very much.

It’s easy enough, in your formatting.php file change the following line:

function wpautop($pee, $br = 1) {
to
function wpautop($pee, $br = 0) {

done.. Now WP will still insert <p> tags throughout but not as many fo them.. I haven’t gotten around to solving that problem but I imagine it’ll be just as simple.  Remember that when you upgrade to a newer version of WP you might have to go in and make this adjustment again

Tags: , , , ,

Creating a custom slideshow for your wallpaper in ubuntu

So it seems that I’ve had a similar experience to a lot of people changing their wallpapers in ubuntu.  You’re scrolling through a bunch and in the list you notice this one called cosmos that doesn’t quite looks like the rest.  “Hmmm, what’s this?’ you think.  This looks like a bunch of images stacked on top of each other.  Could it be?  And yes, it is, it’s a multi-image slideshow that can have as your background that rotates on a schedule that you choose.  I immediately sat down and started figuring out how this thing works and in the end it was pretty simple, time consuming to setup as you have to input a ton of values into an xml file but simple.  I’m not going to go into huge detail about how it works if you want to read more head over to http://www.linuxjournal.com/content/create-custom-transitioning-background-your-gnome-228-desktop

So today I stumbled upon a motherload of amazing 3D space art at http://joejesus.deviantart.com and I go completely gaga over space art.. My wallpapers are all sci-fi scenes, I just can’t get over how breath taking some of these are.  So I raided the guys stash and ended up with around 30-40 new pieces for my wallpaper slideshow and like hell was I going to enter all of these in by hand so off I went searching for a nice little script that would do it for me.  I mean come on, one of the reasons I’m a linux user because I gave up the notion that time consuming repetitive tasks were something that you had to do by hand and sure enough I found a wonderful gentlemen over at the ubuntu forums who coded up a beauty of a script that worked like a charm.  So make sure to head over to : http://ubuntuforums.org/showthread.php?p=9578962 and give the guy a big thank you hug for saving you hours of work, and read the instructions on how to use it.

Here’s the script, just copy and paste this into a file, chmod it to 755 and you’re off to the races:

#!/bin/sh
#This script creates xml files that can act as dynamic wallpapers for Gnome by referring to multiple wallpapers
#Coded by David J Krajnik
if [ "$*" = "" ]; then
  echo "This script creates xml files that can act as dynamic backgrounds for Gnome by referring to multiple wallpapers";
  echo "Usage: mkwlppr.sh target-file.xml [duration] pic1 pic2 [pic3 .. picN]";
else
  files=$*;
  #Grab the name of the target xml file
  xmlfile=`echo $files | cut -d " " -f 1`;
  #remove the first item from $files
  files=`echo $files | sed 's/^\<[^ ]*\>//'`;
  if [ "`echo $xmlfile | grep '\.xml$'`" = "" ]; then
    echo "Your target file must be an XML file";
  else
    inputIsValid="true";
    firstItem=`echo $files | cut -d " " -f 1`;
    duration="1795.0";#set the default duration
    if [ "`echo $firstItem | grep '^[0-9]\+\.[0-9]\+$'`" != "" ]; then
      echo "The duration must be an integer";
      files=`echo $files | sed 's/^\<[^ ]*\>//'`;
      inputIsValid="";
    elif [ "`echo $firstItem | grep '^[0-9]\+$'`" != "" ]; then
      #If the item is a number, then use it as the duration for each wallpaper image
      duration="`expr $firstItem - 5`.0";
      #remove the duration from the list of files
      files=`echo $files | sed 's/^\<[^ ]*\>//'`;
    fi
    if [ "$files" = "" ]; then
      echo "You must enter image files to associate with the XML file";
    else
      for file in $files
      do
        if [ ! -f $file ]; then
	  echo "\"$file\" does not exist";
	  inputIsValid="";
        elif [ "`echo $file | sed 's/^.*\.\(jpg\|jpeg\|bmp\|png\|gif\|tif\|tiff\|jif\|jfif\|jp2\|jpx\|j2k\|j2c\)$//'`" != "" ]; then
	  echo "\"$file\" is not an image file";
	  inputIsValid="";
	fi
      done
      if [ $inputIsValid ]; then
        currDir=`pwd`;
        echo "<background>" >> $xmlfile
        echo "  <starttime>\n    <year>2009</year>\n    <month>08</month>\n    <day>04</day>" >> $xmlfile;
        echo "    <hour>00</hour>\n    <minute>00</minute>\n    <second>00</second>\n  </starttime>" >> $xmlfile;
        echo "  <!-- This animation will start at midnight. -->" >> $xmlfile;
        firstFile=`echo $files | cut -d " " -f 1`;#grab the first item
        if [ "`echo $firstFile | sed 's/\(.\).*/\1/'`" != "/" ]; then
          #If the first character in the filename is not '/', then it is a relative path and must have the current directory's path appended
          firstFile="$currDir/$firstFile";
        fi
        firstFile=`echo $firstFile | sed 's/[^/]\+\/\.\.\/\?//g'`;#Remove occurrences of ".." from the filepath
        files=`echo $files | sed 's/^\<[^ ]*\>//'`;#remove the first item
        prevFile=$firstFile;
        currFile="";
        #TODO add absolute path to the filenames
        #if $currFile =~ "^/.*" then the file needs to path appended
        echo "  <static>\n    <duration>$duration</duration>\n    <file>$firstFile</file>\n  </static>" >> $xmlfile;
        for currFile in $files
        do
          if [ "`echo $currFile | sed 's/\(.\).*/\1/'`" != "/" ]; then
            #If the first character in the filename is not '/', then it is a relative path and must have the current directory's path appended
            currFile="$currDir/$currFile";
          fi
          currFile=`echo $currFile | sed 's/[^/]\+\/\.\.\/\?//g'`;#Remove occurrences of ".." from the filepath
          echo "  <transition>\n    <duration>5.0</duration>\n    <from>$prevFile</from>\n    <to>$currFile</to>\n  </transition>" >> $xmlfile;
          echo "  <static>\n    <duration>$duration</duration>\n    <file>$currFile</file>\n  </static>" >> $xmlfile;
          prevFile=$currFile;
        done
        echo "  <transition>\n    <duration>5.0</duration>\n    <from>$currFile</from>\n    <to>$firstFile</to>\n  </transition>" >> $xmlfile;
        echo "</background>" >> $xmlfile;
      fi
    fi
  fi
fi

Tags: , , , , , , , , , ,

Enabling Autocomplete by reverse searching history in Linux

Being a FreeBSD user I just got used to a very nice feature that would allow me to autocomplete commands based on my history.  So for example if 15 commands ago I had typed ‘cat filenames1 > filename2′ and I wanted to retype that command I could just type ‘cat’ and then press up and it would go through my history and bring up the last command I typed starting with ‘cat’ until I got back to the desired command, only bringing up those in my history starting with ‘cat’ of course.

Unfortunately this isn’t the way it works in linux, in linux pressing up, no matter how much you’ve typed so far will just take you back through the command history.  Sure you can press ctrl-r but I couldn’t be bothered to figure that out.  Besides there is a much cooler way to go about it.

what you  do is to edit /etc/inputrc:
vi gedit /etc/inputrc

somewhere around line 40 is the following:

# alternate mappings for “page up” and “page down” to search the history
#”\e[5~”: history-search-backward
#”\e[6~”: history-search-forward
Uncomment those lines, close term and open an new one and viola!  It works the same but with page up and down instead.  Beauty!  If you didn’t know about this at all go in there and turn it on right now because man this is a time saver and a half.  You’ll thank me later!

Tags: , , , , , ,

Page optimized by WP Minify WordPress Plugin