posts tagged ‘code’

Pagination for a Magazine Theme

February 20th, 2014

Say you have a magazine-style WordPress theme. It has a slider that loads three posts, and then a list of recent posts.  The issue of pagination come up when the user hits the Older Posts link.

Maybe you have a front page that displays 3 posts in the slider. The slider is a loop. Then a default loop that shows your most recent posts. And the number of posts is determined by the setting in your Settings – Reading – Blog pages show at most X posts.…

A smart PayPal form

January 9th, 2014

I created this smart PayPal form for Trekkers.org. See trekkers.org/donate/. It lets the user switch back and forth between recurring and one-time donations. I couldn’t find a free plugin that can do this.

If this is installed on a WordPress or other CMS site, it is better set up as a plugin. A site owner does not need to lose all functionality just because he/she switches themes.…

A simple related posts widget

December 2nd, 2013

If you want to put some related posts in a widget you can use the smart YARPP plugin.

Or, if you merely want to list posts with matching tags, you can put a function in your WordPress theme. In some ways this is better than the fuzzy logic of YARPP because it gives you more control: you just give posts the same tag, and you know they are related.…

Responsive Comment Forms

May 29th, 2013

After you make the front page of your theme responsive (see my previous post), you need to check the other templates. And one area that might break your theme, and resists the simple CSS-media-queries method, is the comments form, typically loaded on the single post template. That’s because forms tend to have fixed widths, and whats more, the width is defined with inline HTML, or at least its defined that way by default in the WordPress comments template.…

putting a loop in your sidebar

April 26th, 2013

The simplest way to put a loop in your sidebar is with Justin Tadlock’s sweet plugin Query Posts. This lets you use the query_posts function, with all of its options, in a widget.

However sometimes you might need a loop that does something unusual. I had a client who has a category of posts with natural history photos from near his home. He wanted an image to pop up, randomly selected, from the category.…

Does your slider make the text flicker?

April 24th, 2013

I see this on lots of sites. Flexslider causes it. Every time the slider moves, text on some other part of the page flickers—on Safari. As far as I know, this is a Safari-only issue. The solution, fortunately, is a little CSS:

-webkit-backface-visibility:hidden;

Just put this on whatever is flickering. It also fixes the annoying lines that grow around the ‘navigation spots’ in Safari.…