Woocommerce tricks

I’ve had my first in-depth experience with Woocommerce and this post helped, especially #19:


WordPress: List all PDFs, with a word filter

Author Chris Cummings    Category PHP, Wordpress     Tags

I would have really thought this already existed as a plugin.  I’ve seen the need for lots of churches but also for business sites.  For churches, they often want to list their weekly bulletins on their website.  If a plugin is out there for WP that will do this, I haven’t found it.

But thankfully WP treats media files as posts and has a way to search by type (PDF) so mashing up code from 2 or 3 places and throwing in some PHP magic I’ve written this.  You can put this in a function (as I have) or write a template with it.  In this example you can see at the top that the “$targetword” var is in there…thats the search term used to filter out PDFs that do not contain that word.  My thinking on this is that only PDF files that start with the word “bulletin” (or have that word in them, case insensitive in this instance) will show up.

You could fancy all of this up of course and write some ADMIN code for all of this and built a full plugin with shortcodes and rainbows and exploding pinatas…but I just went “quick’n’dirty” on it.  I will probably have to go back and look at sorting the query to get the order I need but this is a dang good start.  I think so anyway…

function get_attachment_files(){

//the "filter" word...will only show listings with this word in it.
$targetword = "bulletin";

//what we are searching for is basically everything with the type of PDF
$args = array(
    'post_type' => 'attachment',
	'post_mime_type' => 'application/pdf',
    'numberposts' => -1,
    'post_status' => null,
    'post_parent' => null

//get everything in an array
$attachments = get_posts($args);

//if there are results...
 if ($attachments) {

	//format as an ordered list
      "); foreach ($attachments as $post) { //get the post title $tpn = $post->post_title; //only show if the target "filter" word is in that result. if (stripos($tpn,$targetword) !== false) { echo ("
    • "); setup_postdata($post); the_attachment_link($post->ID); echo ("
"); } } echo (" "); } }

Box Shadow Inset on Input Field? Yes, please!

Author Chris Cummings    Category CSS     Tags

Can you put a CSS3 box shadow on an input field?  You can!  The only thing you have to do is to set a background color or transparent to the field:




WordPress Plugins I use

Author Chris Cummings    Category Wordpress     Tags

This is a list of WordPress plugins I use in various places for various things.  This list will probably be updated from time to time.

  • Simple Backup
  • Ajax Event Calendar
  • HeadSpace2
  • Under Construction
  • Child Pages Shortcode
  • Contact Form 7
  • IQ Testimonials
  • List Pages Shortcode
  • WordPress Important
  • WP Sitemap Page

Last Web Page Update (IE is good for something!!!)

I needed to know when a website was last updated…so I dug around online and on this page:!topic/chrome/FCdMwM7mgPU

I found out this works (seems to not work in Chrome but will in IE.):

  1. Dig around for that long-lost IE icon and click it.
  2. Open a web page
  3. In the address bar, replace the full address with: javascript:alert(document.lastModified)
  4. Hit enter and you will get a pop up with date info



A Good Way To Deal With Padding

Author Chris Cummings    Category CSS     Tags

This is probably old hat to most but I just saw this and didn’t realize it was in CSS(3) so here we go:

-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;

This little tidbit here will enable you to pad things without doing “padding math”. In other words it pads things on the INSIDE of a box, not added to.

That’s it. Short’n’sweet.


Lost Google Analytics Login? Maybe this will help…maybe.

Author Chris Cummings    Category Google     Tags

So I set up a site on Analytics many moons ago and I’ve forgotten what email address I used.  Took some searching but maybe this form is going to help me:



C# Contact Form on GoDaddy

Author Chris Cummings    Category C#, GoDaddy     Tags

Hi!  How are you? I’m fine, thanks for asking! :-)

I haven’t posted any C# stuff in a while but I’m working on something that bears mentioning.  If you are sending C# emails via a contact form you’ll want to see this site:

And use this code:

// language -- C#
// import namespace
using System.Web.Mail;

private void SendEmail()
   const string SERVER = "";
   MailMessage oMail = new System.Web.Mail.MailMessage();
   oMail.From = "emailaddress@domainname";
   oMail.To = "emailaddress@domainname";
   oMail.Subject = "Test email subject";
   oMail.BodyFormat = MailFormat.Html;	// enumeration
   oMail.Priority = MailPriority.High;	// enumeration
   oMail.Body = "Sent at: " + DateTime.Now;
   SmtpMail.SmtpServer = SERVER;
   oMail = null;	// free up resources

IE, Forms, Image Submit Buttons = Bad Mojo

Been a while, huh?  Yeah well, you know…

Found out IE submits funky stuff for the value of a form button that is an image.  Better to slap a hidden field in your form.  More info here

So, yeah, that’s all.  Short but helpful?  I hope so.