More Finance Calculators

These folks emailed us and they have some decent finance calculators on their site: Ultimate Calculators
I found the loan application one particularly interesting… haven’t seen that one before.
Cheers!

Unfiltered #3 – HR5034 and Craig Wolf Puppet

Paul Maybray of VinTank gives a nice overview of HR5034. That’s a bill in Congress that would add even more restrictions on shipping wine, which we’ve covered before. Safe to say, it’s a bad bill for wine lovers (but a good bill for distributors with lots of lobbying money, so we’ll see how it turns out).

Paul chats with a puppet version of Craig Wolf, who is CEO of the Wine and Spirits Wholesalers of America (WSWA). Just watch. It will make sense, and you’ll have more insight into this mess.

Click here to view the embedded video.

More info, including sources for the Craig Wolf quotes, on the VinTank blog.

WordCamp Philly 2010 Presentation Slides

Here are slides from my talk. I was told a video of the presentation will be up at WordPress.tv sometime soon. I’ll post a link when it is. And I’ll try to get these in SlideShare or something similar. I was having trouble with their site earlier.

Business Models for WordPress Plugin and Theme Distribution
What You Need to Know About the GPL

Download: ppt, pptx

Use Coupon Code WINELOG for MyWinesDirect

MyWineDirect.comI’m happy to bring you this deal. Remember to use the coupon code WINELOG to get the promotion.

MyWinesDirect.com features the best wines for the value from undiscovered vineyards around the world.  With fall and holiday celebrations around the corner, it’s the perfect online wine store to find impressive wine gifts and wine gift baskets to celebrate any occasion.  For a limited time, they are offering 10% off all wine gifts plus FREE shipping to WineLog members.  Use coupon code WineLog at checkout to take advantage of this great offer.

How Recent Government Action Has Benefited Me

I went through this list in my head, and it sounded fairly substantial to me. So I wanted to share this with folks to see that (1) what happens in Congress matters and (2) the Obama administration has done a lot of good things that are beneficial at least to me.

The recent Health Care Reform (Obamacare) has benefited myself and my family in many ways:

  • Because our 2 year old son has “pre-existing conditions”, we were not able to change our healthcare plan before HCR provision went into affect in September. We are in the process of applying for a new plan, and should be able to get it. If we get the plan we’re shooting for, it will save us about $100 per month, have lower deductibles, and just generally be a better fit for our family now.
  • Under HCR, our LLC can write-off health care premiums BEFORE social security tax is taken. This means that if our insurance premiums are about $5000 per year, we will save about 13% of that or about $650 on our taxes.
  • My step sister, who is finishing up college now, was kicked off her mother’s health insurance one week before the HCR provisions went into affect that would let her stay on her mother’s plan until she turns 26. She’s now in the process of getting back on her mother’s insurance plan. If she couldn’t have done that, she would have had to buy a more expensive plan herself that is hard to afford for a student.

Other tax cuts as part of the stimulus and elsewhere have saved us hundreds of dollars in taxes, and will save us hundreds on our taxes next year.

We are also currently in the process of refinancing our house under the Home Affordable Refinance Program (HARP). This program, which is widely regarded as a failure because people are not using it for various reasons, is going to help us save about $200 per month on our mortgage. Because we initially purchased our home with just 5% down and home values have dropped, we would not have the 80% loan-to-value ratio needed to qualify for a refinance without this program. I don’t want to jinx it, but it looks like it will work for us.

There is also a ton of potential legislation that may impact myself or people close to me.

  • Job growth ideas that focus on tax credits for creating jobs (like Joe Sestak proposes) vs. tax cuts for wealthy individuals and businesses (like most Republicans favor) could affect our business. We are on the cusp of hiring contractors or employees for our business. I would be more likely to hire someone if there were more credits in place for that vs. tax cuts that won’t affect me (unless we do really really well next year ;).
  • Candidates who are more hawkish are more likely to extend our wars in Iraq and Afghanistan or engage in new wars in Iran, etc. Less war = less chance my brother who is in the air force will spend more time at war. Obama is 50/50 on this so far, having drawn down forces in Iraq while sending more troops to Afghanistan. I do think that (a) someone like John Mccain would have resulted in higher troops counts at war than this, (2) Obama does seem to be serious about withdrawal dates and should draw things down in Afghanistan according to plan, and (c) he is more likely to use diplomacy to handle situation in Iran, etc.

I hope this list helps you to identify ways that your own life has been improved by recent government actions. Even if you don’t have any personal accounts like this, you can at least see how it has affected someone like me: a middle class small business owner with a new family.

Duplicate comment detected; it looks as though you’ve already said that!

Not sure how long WordPress has been doing this, but there is a check for duplicate comments. If the same user/email posts the same exact comment on the same post, the user will get a message like:

Duplicate comment detected; it looks as though you’ve already said that!

This is great actually, and keeps people from submitting the same comment twice if they get impatient waiting for moderation or otherwise click that submit button twice.

As a blog owner and WordPress developer, there may be situations where you want to allow people to post the same comment. If you want to enable duplicate comments on your blog for some reason, you can use this code here. Just add it to your theme’s functions.php or put this in a .php in your plugins folder and enable it.

function enable_duplicate_comments_preprocess_comment($comment_data)
{
	//add some random content to comment to keep dupe checker from finding it
	$random = md5(time());	
	$comment_data['comment_content'] .= "disabledupes{" . $random . "}disabledupes";	
 
	return $comment_data;
}
add_filter('preprocess_comment', 'enable_duplicate_comments_preprocess_comment');
 
function enable_duplicate_comments_comment_post($comment_id)
{
	global $wpdb;
 
	//remove the random content
	$comment_content = $wpdb->get_var("SELECT comment_content FROM $wpdb->comments WHERE comment_ID = '$comment_id' LIMIT 1");	
	$comment_content = preg_replace("/disabledupes\{.*\}disabledupes/", "", $comment_content);
	$wpdb->query("UPDATE $wpdb->comments SET comment_content = '" . $wpdb->escape($comment_content) . "' WHERE comment_ID = '$comment_id' LIMIT 1");
 
	/*
		add your own dupe checker here if you want
	*/
}
add_action('comment_post', 'enable_duplicate_comments_comment_post');

For reference, here is the dupe check code in wp-includes/comment.php. A newer version should probably have a hook above and/or below to allow people to override the dupe checker more directly.

// Simple duplicate check
	// expected_slashed ($comment_post_ID, $comment_author, $comment_author_email, $comment_content)
	$dupe = "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = '$comment_post_ID' AND comment_approved != 'trash' AND ( comment_author = '$comment_author' ";
	if ( $comment_author_email )
		$dupe .= "OR comment_author_email = '$comment_author_email' ";
	$dupe .= ") AND comment_content = '$comment_content' LIMIT 1";
	if ( $wpdb->get_var($dupe) ) {
		do_action( 'comment_duplicate_trigger', $commentdata );
		if ( defined('DOING_AJAX') )
			die( __('Duplicate comment detected; it looks as though you’ve already said that!') );
 
		wp_die( __('Duplicate comment detected; it looks as though you’ve already said that!') );
	}

Jason Speaking at WordCamp Philly October 30th at Temple University

I will be speaking on Business Models for Plugin/Theme Distribution. What You Need to Know About the GPL at WordCamp Philly October 30th, 2010 at Temple University in Philadelphia.

With lots of sweat and little luck, we’ll have our membership plugin available for some sort of release by then. But really I’m excited to share my thoughts on how to distribute, market, and make money off this plugin… and more interested in others ideas about the same.

If you want to hear me speak or are otherwise interested, get your ticket now.

SS-Downloads WordPress Plugin

Testing our new SS-Downloads plugin. It basically will require an email address before serving a specified file. Right now, I’m using a zip of the pre-release plugin for testing. I will update this to point to the latest version once it’s ready.

Should see a form or download link here.

Enter your email address to download ss-downloads.zip

Future plans:

  • Option to require account creation (instead of just an email address). Done
  • Option to email file as attachment instead of showing a link. Done
  • Icons for files in template.

Make One Category Display Full Posts in Thesis Theme

Got a request from a client to have a specific category page on their WordPress blog running the Thesis theme show full posts (vs. excerpts) for just one category. So I’m going to figure it out and write the steps here for the benefit of humanity.

First, to be clear, I’m not talking about changing ALL CATEGORY PAGES from excerpts to full posts. That can be done easily through the Thesis Display Options. You would change the “Posts” display options to “display full content” and the “Archives” display options to “same as home page”.

What I want to do is show excerpts on every category page except one. You do this by settings up a custom category theme, and Thesis has its own way to do that. A custom category theme wasn’t optimal for this install, so I need to do something different. It’s good to have different ways of doing things. Maybe my method below works for you too.

Here’s what we’re going to do.

  1. Use the “thesis_hook_before_post_box” hook to check the current category and if it is the “Quick Takes” category, change the $thesis[‘display’][‘archives’][‘style’] value to “content”.
  2. Use the “thesis_hook_after_post_box” hook to change the $thesis[‘display’][‘archives’][‘style’] value back to what it was before we tweaked it.

Sounds complicated, but it’s only a few lines to add to the /custom/custom_functions.php file in your Thesis theme folder.

function quicktakes_fullpost_setup()
{
	$target_category = "Quick Takes";
 
	//saving the global archives display setting so we can revert later
	global $thesis, $saved_thesis_display_archives_style;
	$saved_thesis_display_archives_style = $thesis['display']['archives']['style'];
 
	//checking the category, if it's the target category, then set the display to full post
	$current_category = single_cat_title("", false);
	if($current_category == $target_category)
		$thesis['display']['archives']['style'] = "content";
 
}
function quicktakes_fullpost_cleanup()
{
	//we're setting the display archives style back to what it was before we tweaked it
	global $thesis, $saved_thesis_display_archives_style;
	$thesis['display']['archives']['style'] = $saved_thesis_display_archives_style;
}
add_action('thesis_hook_before_post_box', 'quicktakes_fullpost_setup');
add_action('thesis_hook_after_post_box', 'quicktakes_fullpost_cleanup');

Be sure to change the $target_category variable to the title of the category you want to change.

If you want to do the inverse of this, which would be to show the excerpt on just one category page and update show the full post on all others, you would:

  1. Change the Thesis Display Options for posts to “display full post content”
  2. Change the Thesis Display Options for archives to “same as your homepage”
  3. Then adjust line 12 in the code above to set the style to “excerpts” instead of “content.

I hope this helps. Let me know if you have any questions about this or similar customizations for Thesis.

WordPress get_the_content_after_more() Function

In WordPress, if you want to get just the excerpt of a post, you can use the built-in functions the_excerpt or get_the_excerpt. And if you want all of the content, you can of course use the the_content or get_the_content functions. But what if you want to get everything BUT the excerpt?

The Code

Here is a function that will do that: get_the_content_after_more()

function get_the_content_after_more()
{
	$content = get_the_content();
	$moretag = preg_match("/\<span id="\&quot;more-[0-9]*\&quot;\">\&lt;\/span\&gt;/", $content, $matches);
	if($moretag)
	{
		$morespan = $matches[0];
		$morespan_pos = strpos($content, $morespan);
		$newcontent = substr($content, $morespan_pos + strlen($morespan), strlen($content) - strlen($morespan));
		$newcontent = apply_filters('the_content', $newcontent);
		return $newcontent;
	}
	else
		return "";
}

How to Use This

Notice that this is a “get_” version of the function. So you will get to echo the results or save them to a variable for future use. Just plop an echo get_the_content_after_more() into your LOOP and you’re good to go.

How it Works

The function works by getting the post content through “get_the_content” (and so will give you the content for the current post in your loop) and looking (preg_match) for the span tag that WordPress puts at the more break. (If older versions of WordPress don’t add this tag, this function won’t work. But this works in 2.9-3.0 at least.)

If a more tag is found, I create a variable $newcontent holding everything after the more tag. Then I run it through apply_filters to all of your plugins/etc that work on the_content will work on this.

If a post doesn’t have an excerpt (no excerpt or more tag in the post), the function returns an empty string.

The function could easily be called get_the_inverse_excerpt or get_the_content_after_excerpt or get_the_content_minus_excerpt. Let me know if you have a better idea for this… or tell me what you searched for to figure this out.

Why Would I Use This?

Kim was updating our portfolio page, which is really a list of WordPress posts. She wanted to style the “excerpt” differently from the rest of the content. Notice how the top section (“WineLog is…”) is in a gradient box on the WineLog portfolio item… and then the rest is styled as written in the post content. We used code like this:

<div class="excerpt">
<?php    
    the_excerpt();
?>
</div>
<?php     	
    echo get_the_content_after_more();			
?>

When we decided to do this, I first checked if WordPress was adding some tag around the excerpt that we could piggy back on. Nope. All that is added is a span like at the point where the more break is. Then I looked for a buit-in function or some parameter of the_content that could be used to do this. No luck. (Let me know if there is a built-in way to do this.)

If I Were Updating WordPress…

… and it’s open source. So maybe I will. One could add a parameter to the_content/get_the_content functions to exclude the excerpt. The code would be largely the same, though they could look for the more tag itself since they won’t have that stripped out yet. That feels clunky to me. Let me know if you have better ideas.