Sort get_users by last name

Posted by & filed under Code Tips.

Not sure why, but it looks like sorting on last name and first name is not built into the WordPress get_users method. Seems like it would be a pretty basic need, but it’s not there. So, it’s on to PHP to make it happen. This bit of code assumes that $user_list has already been filled… Read more »

Redirect after WordPress comment

Posted by & filed under Code Tips.

Quick little snippet to redirect your visitors to another page after they leave a comment. Normally after leaving a comment in WordPress you’re sent back to the page where you left the comment. By using the comment_post_redirect filter you’ll be able to control where they go. As it’s written, this code will redirect back to… Read more »

Blocking WordPress comments

Posted by & filed under Code Tips.

For a site I’m working on I needed a way to intercept a comment and block if a specific condition wasn’t met. This is what I wound up with. This hooks into the preprocess_comment filter which normally lets you edit comment data before it’s submitted to the database. In this case we’re not doing anything… Read more »

Always Edit in HTML WordPress plugin

Posted by & filed under WordPress.

This is another one of those plugins that I’d thought about writing and Google kept me from needing to. Sometimes when building a WordPress site I’ll need to create pages using straight HTML instead of the WYSIWYG editor. Without fail though I’ll accidentally click on the Visual tab and the editor will clear out most of my… Read more »

How to remove .lead CSS class from parent theme

Posted by & filed under Coding, WordPress.

I’ve usd the 320press Bootstrap WordPress theme as a parent theme on a couple of projects, including this site. Overall, it’s great. But there’s been one little nagging “feature” that I’d like to get rid of. The theme adds a lead class to the first paragraph of each post. And the parent CSS for .lead… Read more »

WordPress WYSIWYG editor not working

Posted by & filed under Blogging.

Moment of stupidity today… For probably the past year or so the visual editor hasn’t been working for me in WordPress. Just always plain text. No visual tab at all. And I checked. The disable WYSIWYG editor checkbox was clear for my account. Today I tried checking the checkbox, saving settings, and then clearing the… Read more »

Updated Plain Text CPT Plugin

Posted by & filed under WordPress.

Had to do a quick update for my Plain Text Custom Post Type WordPress plugin. Right now I’m only using it one site, and I’ve never noticed a problem until this week. The JavaScript wasn’t working from another computer. Turns out it was conflicting with the stats module in Jetpack. Jetpack inserts a bit of… Read more »

Margins around MathJax equations in WordPress

Posted by & filed under WordPress.

Love the MathJax plugin for WordPress. Makes it really easy to insert equations, assuming you’re somewhat familiar with Latex formatting. Problem is, there is always no space below the equation. I’ve been just hitting enter a couple of times after the closing latex tag, but I wanted a better solution. Since there’s a syntax attribute… Read more »