Tag Archives: Post List WP plugin

Thank You and Sorry to My Plugin Users

So in the last six months or so I’ve gotten much worse about answering the frequent comments left on this site regarding my three WordPress plugins, PDF Creation Station, Easy Edit Links and Post List. I want to thank everyone who has left praise for my creations and say that I’m thrilled at the lack of complaints considering what a learning curve they have and the fact that they’ve actually got a fair number of little bugs that I’ve never taken care of because they don’t affect me  when I use them on my own website. I can’t believe Post List and Edit Links are both at a five star rating as of this post.

And I just remembered as I was writing this, that Advanced Post List exists. This is a plugin that someone developed that is based off my Post List code. I remember he contacted me a year or two ago and asked my permission to do this, which of course he didn’t need, but was just being polite. I tried out his version and it didn’t work and I told him that if he got it working and he hadn’t removed any notable features, I’d officially deprecate my Post List plugin and send all my users to his. Then I never heard from him again and figured he’d abandoned the project. Turns out he just did a release earlier this month and has far exceeded my user base and still has nearly a five star rating.

So I need to get my local development version of WordPress up and running so I can install his plugin and make sure it works properly, then replace my plugin with a pointer to his, then I will be done with Post List support forever but the functionality will live on. The best of both worlds. One of the beauties of the open-source arena.

And I know I said I’d get back to working on Creation Station as someone pointed out a bug with disappearing images that I was able to reproduce on my own site, and the PDF engine, TCPDF, has probably come out with updates that need to be added. But frankly, I just have other priorities. I wish someone else would take my Creation Station code and start calling it their own. As far as I know it’s still the best PDF plugin for WordPress and it’s sad that it’s not being developed or actively supported anymore.

And I abandoned Easy Edit Links a long time ago because the WordPress core came out with a solution that solves the same problem… even though Easy Edit Links works better.

So anyway, I’m going back to work on my latest novel, so I’m sorry everyone who has asked a support question and is waiting for a reply. I will probably get back to you at some point, but I may start going through them in batches once a month or so, so I apologize for that.

But I must say, it has been pretty great doing these plugins. Definitely one of the proudest moments of my career, even though I don’t think I made more than two hundred bucks in donations total between all three of them. Most of the code I have written professionally was, in one form or another, designed to get money from people, so it feels good to have supported a community like WordPress.

Kalin’s Post List version 3.1

Today I released version 3.1 of Kalin’s Post List WordPress Plugin. This, unfortunately, is mostly a cleanup release. I’ve decided to stop forward development on this plugin because I don’t seem to have any problem finding good programming jobs, so I don’t feel the need to expand my portfolio so much anymore and really need to focus on my story writing, which is still my first love. I do, however, intend to continue addressing bugs, maintaining current WordPress compatibility, and answering user questions.

If you have any interest in continuing forward development on this plugin, by all means, feel free. I’ll offer any advice or help I can.

There were a number of little bugs that I had to fix:

  • removed contextual help and added a link to the same help page on my website. this help menu was causing a problem with a small number of users who had XML support issues in their PHP installation. The help page is still available in the plugin source files
  • added [post_content] shortcode back into the documentation after I accidentally deleted it
  • removed global $post object from comments callback. Fixes bug where an extra post was being added to the page when this shortcode was used
  • Did same thing for php_function callback to fix the same issue. using php_function now requires you to pass in the necessary information through the shortcode parameter
  • removed a bunch of orderby options because they had stopped working in recent WordPress core upgrades
There were some features I really wanted to add, but decided not to dedicate the time:
  • custom taxonomy support
  • ability to list by author
  • ability to list comments as though they were posts
  • ability to select post status, so you can list only future posts or exclude private posts, etc.
  • ability to export all your presets to a JSON string or file, so you could save all your presets to your local computer, just in case your WordPress crashed or you needed to transfer them to a new blog.
  • advanced sorting to allow orderby to work for post slug or category
  • multi-level listing, such as ability to list off categories/tags/parents with sub-posts listed below each

When Atheism and Anarchism Coincide (Post List Test)

Today I released the new version 3.0 of Post List, my WordPress plugin that allows you to build presets that you can then refer to by shortcode in your posts, or add to your theme with a PHP snippet. Also, new in version 3.0 is a widget. I’ve added one called “recent posts” to my left sidebar, though I’m not sure if I’m gonna keep it. I’ve also added a bunch of cool features to Kalin’s Post List, like a shortcode to call a custom PHP function, post comments, tags, cats, and parent shortcodes, and a preview feature so you don’t need to make a test post to see what your list will look like.

One other feature I’ve added is the ability to require that all your selected tags or categories be included in every post, as opposed to the default behavior which only requires each post to have one of the selected tags or categories. This makes it so you can make lists of overlapping things, so just as a test to show you, I thought I’d give you a dynamically generated list of my blog posts that fall under both the atheism and anarchism categories.

Thou Shalt Not Lie - 02-23-2014
Faith • Equality • Family - 11-05-2012
Glass Houses Can be a Great Strategy - 10-12-2012
How do I Kill the Negativity? - 04-03-2012
Republican Dominated Florida Legislature Passes Bill Allowing Prayer In School | Addicting Info - 03-03-2012
Why is Breast Cancer not Scary? - 10-06-2010
Crime is not Logical - 09-07-2010
Thoughts on Dual Perspectives and the Hoarders TV Show - 08-08-2010
True Story About Isaac Zamora: Middle Finger Vengeance - 08-02-2010
20 Logical Fallacies - 07-26-2010
Why Most Americans Support Terrorism - 05-23-2010
Everything is OK series - 05-22-2010

Injecting Custom PHP Functions into Kalin’s Post List

In version 3.0 of Kalin’s post List WordPress Plugin, I added a new feature that adds even more customizability, the [php_function] shortcode which you can use to call any user-defined PHP function you have created. In version 3.1 of the plugin, I changed it slightly.

Here’s how to use it.

First, add this line into your wp-config.php file:

define("KALINS_ALLOW_PHP", true);

It will need to go above the line that says “That’s all, stop editing! Happy blogging.” This is for security, just to be on the safe side. I don’t believe there are any major security issues with this, but if I’m wrong, this ensures that no blog will be put at risk without permission.

Next, create your function. I put mine in my wp-config.php file, but you could probably put it in other locations. You can name your function whatever you want, as long as it’s unique. Your function may have one or two parameters. The first one (new in version 3.1) will always be the $post object for the current post in the list. If you can’t get all the necessary information from the $post object, the second parameter will be your optional custom param. If you require more than one custom parameter, you will need to pass it in as a delimited list or JSON string. The parameter will be a string, so if you need numbers or booleans, you will need to run a conversion on them.

Now that your function is ready, you can call it with the shortcode [php_function name=”function_name” param=””]. Replace the ‘name’ parameter with the name of the function. Replace the ‘param’ parameter with the function parameter(s).

As of version 3.1, this function no longer runs in a pseudo wordpress loop, so you cannot use the global $post object, but you now use the first parameter of your function, which should be the correct $post object.

The other option for getting post info is to actually pass it in through the ‘param’ parameter by use of a shortcode within the shortcode. For example, if you wanted a function called ‘myFunction’ to receive the post’s author as its parameter, you would use the shortcode: [php_function name=”myFunction” param=”[post_author]”]. The internal shortcode can even have its own parameters if you want. A shortcode with parameters inside a shortcode parameter that all runs inside a shortcode. 🙂

—————————-

So here is an example of something simple you can do with this feature. If you copy this code into your wp-config.php, it will output an edit link only if the currently logged in user is the author of the post. You can then refer to this function in your post list with the shortcode: [php_function name=”postListEditLink”].

define("KALINS_ALLOW_PHP", true);
function postListEditLink($post){
	$user = wp_get_current_user();
	$wpurl = get_blogInfo("wpurl");
	if($post->post_author == $user->ID){
		return '<a href="' .$wpurl .'/wp-admin/post.php?post=' .$post->ID .'&action=edit" >edit</a>';
	}else{
		return "";
	}
}

Customize Display of Comments in Kalin’s Post List and PDF Creation Station

In version 3.0 of  PDF Creation Station WordPress plugin, and version 3.0 of  Post List, I added a shortcode for post comments that looks like : [post_comments before=”” after=””]. Naturally the biggest issue with this is that some folks want a specific formatting and perhaps other special handling such as removing pingbacks, customizing name/date formatting or dealing with nested comments. Here’s how you can add your own function to handle post comments in the PDF.

Currently in kalins-pdf-creation-station.php, or kalins-post-list.php, you will see a function called commentCallback($matches). This is currently what processes the comments shortcode. You will see the first thing it does is check to see if you have defined your own comment callback function:

if(defined("KALINS_PDF_COMMENT_CALLBACK")){//remove this if statement if you copy this function to use it as a custom comments function
return call_user_func(KALINS_PDF_COMMENT_CALLBACK);
}

So the first thing you want to do to create your custom comment function is copy this whole function into your wp-config.php file and give it a unique name. You could probably put it somewhere else and this would still work. Then remove the if statement that checks for your custom callback (very important to prevent infinite loop). Then you simply modify it to display the comments however you want.

The final step is to also put this code into your wp-config.php file and replace the name of the function:

define('KALINS_PDF_COMMENT_CALLBACK', 'my_function_name');

Doing this should give you your custom comments display and should remain in effect even after upgrading to a new version of this plugin.

Kalin’s Post List Version 2.0 Released

Celebrations.

Today I released version 2.0 of my WordPress plugin called Kalin’s Post List. Here’s some of the features I’ve added:

*added Custom post type support
*”None” post support (you can now use the plugin to simply insert plain HTML. Shortcodes here refer to current page)
*support for listing pages/custom posts based on parent page (including current page)
*post thumbnail/featured image shortcode
*shortcode for link to page/post PDF (requires PDF Creation Station plugin)
*format parameter for total customization of all date/time shortcodes
*length parameter to [post_excerpt] shortcode
*offset parameter for [item_number] shortcode to start count at something other than 1
*shortcodes now show nothing if no results instead of broken/empty list
*fail gracefully when incorrect preset param entered (shows error if admin, nothing if regular user)
*improved handling of HTML-conflicting characters
*strip shortcodes out before showing excerpts
Kalin’s Post List creates a shortcode or PHP snippet for inserting dynamic, highly customizable lists of posts or pages such as related posts or table of contents into your post content or theme.
Code is poetry.

Become a Kalin’s WordPress Plugin Beta Tester

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-pdf-creation-station/

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:

*Added support for custom post types
*moved the code identifying the default PDF directory and URL into a few constants at the top of kalins-pdf-creation-station.pdf, so that hackers can easily change them to whatever they want. Added example code that can be un-commented to change the PDF directory to use the base domain of your site instead of the wordpress uploads directory.
*Fixed minor bug where ‘reset defaults’ on the settings page wasn’t refreshing the ‘post slug’ and ‘show on home’ checkboxes
*Added “create all” button on settings page
*Added “automatically generate PDFs on publish and update” option on settings page
*changed blockquote code so it uses the ‘pre’ tag because it was the only way to get TCPDF to actually display anything since it doesn’t want to render blockquotes or tables properly
*added post_excerpt code to use “wp_trim_excerpt”, which doesn’t appear to be functioning anymore — then changed to manually extract 250 characters from the page content
*added option to run other plugin shortcodes to both settings and tool pages
*added option to convert embedded youtube videos into a link to that video
*added ‘format’ parameter to all time shortcodes for total custom date/time formatting
*added ‘length’ parameter to the post_excerpt shortcode to set character count of the excerpt
———————-
New stuff in the works for Kalin’s Post List version 2.0:
*add format parameter for total customization of all date/time shortcodes
*add length parameter to [post_excerpt] shortcode
*add offset parameter for [item_number] shortcode to start count at something other than 1
*add ‘increment’ param for [item_number] shortcode to allow counting by something other than 1
*Custom post type support
*”None” post support (use the plugin to simply insert plain HTML)
*support for listing pages/custom posts based on parent page
*post thumbnail/featured image shortcode
*shortcode for link to page/post PDF (requires PDF Creation Station plugin)

Post List – I’m a WordPress Plugin Makin Machine

I released my latest WordPress plugin, Kalin’s Easy Edit Links, about an hour ago (I used it to add the link earlier in this sentence) and I’m now in process of building my third WordPress plugin, which I’m calling, Kalin’s Post List. It is basically a shortcode that you can insert into a post or page (or function-calls you can insert into a theme) that will display a customized list of posts. Hopefully development goes as well as my previous two plugins and I can have this out in a month or two. No promises, though.

My plan is to make this pretty feature-rich, so this plugin can be utilized as a related posts or random posts plugin. It will allow you to limit the results to certain categories or tags (will even set it so it can dynamically sense the category or tag of the current page), set the count, order by (there’s like a dozen different ways WordPress can return post database results), before list HTML and after list HTML. But I think the key to this plugin is going to be my plan to have shortcodes within the shortcode. There will be a setting for the actual list item HTML, which will allow the user to insert plugin-specific shortcodes that refer to the current post in the list, similar to how I structured the shortcodes in Kalin’s PDF Creation Station. This will allow you to completely customize the display to have a link to the post, show the excerpt, date, author, modified date, comment count, ID, whatever you want, and still be able to have any HTML you want injected around those items, as opposed to the way most plugins like this function where they have their own static HTML structure with a few options inserted.

Now I know what you’re thinking: “Sounds too complicated. Do you seriously expect me to write a bunch of HTML into a shortcode, then deal with shortcodes within that shortcode and keep track of half a dozen other options while I’m trying to write a post?”

This is why I’m going to add two important features: first, obviously, is default options that you can set on the settings page so if you’re reusing the same shortcode, you can just set them once and use a minimized shortcode in the actual post. However, if you want to use this plugin on different pages with different settings, there will be a shortcode generator engine on the settings page, so you can set all your settings through normal form controls then output them all to a textfield which you can easily copy and paste into your post. At the same time, I can even have an option to output PHP code for copying into your theme.

From what it looks like, this plugin will actually be pretty lightweight in terms of overall blog performance.  Often times plugins need to add hooks all over the place for catching this or that piece of data. All this plugin requires is a settings page and a single shortcode function. They will be fairly complex, of course, but will only run when they are specifically called.

I plan to use this myself on all my main index pages, for my MicroBlog page, as a related posts list at the bottom of every post, and as a recent posts and/or random posts sidebar widget.