Today I released version 2.0 of my WordPress plugin called Kalin’s Post List. Here’s some of the features I’ve added:
If you believe police are the good guys, please listen to this audio. I know it’s Egypt and we in America will all say it’s too far away to be relevant but the fundamental attitudes and philosophies of police are the same here as they are over there.
Also check out this video. Crazy stuff.
In version 2.0 of Kalin’s PDF Creation Station, which I released earlier today, I moved some code around to facilitate the ability for people with a basic understanding of PHP (or even non-coders may be able to get this to work) to customize the location of the generated PDF files.
To do this, first open kalins-pdf-creation-station.php in a text editor (located in plugins/kalins-pdf-creation-station/), or enter the edit section under ‘plugins’ in your WordPress admin and find the file.
The code that designates the PDF directory currently begins on line 40 (this may change in the future, though probably not by much. Refer to code comments for updated information.) The code looks like this:
$uploads = wp_upload_dir();define("KALINS_PDF_DIR", $uploads['basedir'] .'/kalins-pdf/');//base location of PDF files define("KALINS_PDF_SINGLES_DIR", KALINS_PDF_DIR .'singles/');//location to save individual page/post PDF filesdefine("KALINS_PDF_URL", $uploads['baseurl'] .'/kalins-pdf/');//the url string will be different from the directory so be careful define("KALINS_PDF_SINGLES_URL", KALINS_PDF_URL .'singles/');
The first line, of course, just grabs the upload directory object of your wordpress installation. Then in the next line we define the base location of PDF files, using the upload directory (files created on the tool page will go here). You can see the second parameter of the define() is the actual directory path. You can change this to whatever you want, even a hard-coded value. The next line defines the location to save the single PDF files (the ones generated by the link on individual pages). This is usually a sub-folder of the base directory, but again you can set it to whatever you’d like, or it can be the same as the base (if you don’t mind a long list of PDFs on your tool page).
Remember, URLs that browsers use to navigate are different from the server directory that PHP uses to modify files. Thus, the last two lines now define the proper URLs that map to the corresponding directories in the previous two lines. You can see this is easy when using the $uploads object to simply grab the ['baseurl'] or ['basedir'] so things match properly, but if you understand your server’s directory structure and URL mapping, you should be able to put the folders wherever you’d like.
Also remember that you will either need to copy this code into wp-config.php or re-do this every time I make an upgrade to this plugin. Beware when copying into wp-config.php that you will not have access to the wp_upload_dir() function so you will need to hard-code the paths or use functions available outside of WordPress. Also remember to add your code above the line that says “/* That’s all, stop editing! Happy blogging. */” The example below should work in wp-config.php.
The actual final PDF folder does not need to exist yet. If it doesn’t, the PDF creation script will create it automatically.
In the next section in the PHP file you’ll find some more commented-out code that looks very similar to what we just looked at.
/* define("KALINS_PDF_DIR", $_SERVER['DOCUMENT_ROOT'] .'/pdf/');//base location of PDF files define("KALINS_PDF_SINGLES_DIR", KALINS_PDF_DIR);//location to save individual page/post PDF files define("KALINS_PDF_URL", "http://" .$_SERVER['HTTP_HOST'] .'/pdf/'); define("KALINS_PDF_SINGLES_URL", KALINS_PDF_URL);//this will put all PDFs in the same folder */
If un-commented to replace the previous section, this code will set the base and single PDF locations to the document root of your website in a folder called simply “pdf”.
Now this 17 year old is a true American hero and patriot.
I am currently hard at work on version 2.0 of Kalin’s PDF Creation Station WordPress plugin, which is one of my excuses for not making many blog entries lately. It occurred to me that some users may have SVN and want to get their hands on the new features a little early, before I’m completely finished testing and tweaking. It also helps me a lot to have someone using it before the new features go live.
If you have SVN, the repository locations are
http://plugins.svn.wordpress.org/kalins-post-list/ (for my Post List plugin)
http://plugins.svn.wordpress.org/kalins-easy-edit-links/ (for Easy Edit Links plugin)
Newest beta versions of these plugins should be located in the branches folder. If branches is empty, I have probably taken a break from that particular plugin project. Creation Station is my big project, the other two are comparatively simple plugins.
New stuff in the PDF Creation Station 2.0 beta: