Listify

Listify: How to display default images based on category

David Nash wordpress 4 Comments

You use Listify, the popular directory listing WordPress theme, but want to set default images on a category basis. Here’s how! To customise Listify, it’s best to use a child theme. Listify supplies a skeleton for you to do this. In the child theme’s functions.php, add this: //set default image for all listings function custom_default_listify_cover_image( $image, $args ) { global $post; //get access to the current post //only apply to listings if ( $image || $post->post_type != ‘job_listing’ ) { return $image; } //get the categories for this listing $categories = wp_get_post_terms($post->ID, ‘job_listing_category’); //if it has a category if( !empty($categories) ) …

Create an auto-complete field in WordPress

David Nash wordpress 116 Comments

I’m working on a project that has a large database – about 14,000 business listings. It also has a page for a user to sign up and select which business they work at. 14,000 is way too many options for a SELECT (drop-down) field and I don’t want to put that much load on the MySQL database either. My solution: an auto-complete text field that reads from the WordPress database. I take it one step at a time, and make sure each step works correctly before starting the next step. Here are the steps I took to do it. Front-end JavaScript …

Listify and FacetWP: How to order results by rating

David Nash wordpress 6 Comments

Listify is a WordPress directory listing theme. It allows users to submit listings (of businesses, for example) and also allows users to rate those listings. It uses the WP Job Manager plugin to manage the listings. For some reason, it’s not currently possible to order the search results by user rating. The theme developers have told me that feature is planned for future releases. If you purchase the FacetWP plugin, it becomes possible for the user to order the results, but rating is now included. It took a little digging but here’s the solution, which I think is fairly elegant. Simply copy …

Linux for WordPress Developers – Part 2

David Nash mysql, wordpress Leave a Comment

In Part 1 of Linux for WordPress developers I covered the Apache web server, domain names, .htaccess and .htpasswd files, and extracting the WordPress files. WordPress uses the MySQL database, which can be a little daunting if you’ve never set one up before. I use Ubuntu and I find the easiest way is to use phpMyAdmin, which if you’ve used cpanel as a WordPress developer you’ve probably used this to import the MySQL dump file. You can install it on Ubuntu by following the phpMyAdmin community docs. Creating a database for WordPress Once you’ve installed phpMyAdmin just visit http://localhost/phpmyadmin/index.php and log …

Linux for WordPress Developers – Part 1

David Nash wordpress Leave a Comment

I’ve used Linux for years, and I think it’s perfect for any WordPress developer. When the site is live, chances are it’ll be running on a Linux server. So it makes sense to do your WordPress development on the same system that will be running your finished site. Not only does it cut down on nasty last-minute surprises, it also means that when those surprises do arise, you’ll know what to do when they do occur. I’ve run Ubuntu for a while and think it’s pretty good. I use it for the same reason I develop with WordPress – Ubuntu has …

WordPress REST API now in core WordPress 4.4

David Nash wordpress Leave a Comment

Oh no, Acronyms! Or as I like to say, ON,A! What is REST? It’s a contract of REpresentational State Transfer. What is an API? An Application Programming Interface. So what does all this mean? It means that you can use HTTP to send and receive data to web servers. HTTP is HyperText Transfer Protocol, but let’s keep this simple. Usually when you access websites, your browser sends GET requests to the web server. If you fill out a form it will often be a POST requst (because you’re posting data to it). “But WordPress is has always been a web-based system” I …

WordPress powers a quarter of all websites

David Nash wordpress Leave a Comment

W3Techs collect statistics on web servers, and recently reported that WordPress now runs on 25% of all web servers. On hearing this news, Matt Mullenweg said “Only 75% to go”. And that’s not all. They say “We have indicators that show that WordPress is likely to grow even further. In October, 29.5% of new sites used WordPress. New sites usually show the way where the whole market is heading to.” Why is this important? With so many people using WordPress, it’s likely that whatever unique thing you’d like to do has already been done before. There’s a good chance that …

Tracking Contact Form 7 events with Yoast and Google Analytics

David Nash wordpress 1 Comment

I discovered this while setting up Google Analytics when I recently re-launched my site. I’m using the very popular WordPress plugin Contact Form 7 for a nice AJAX contact form. I’m also using the equally popular Google Analytics by Yoast (GAbY) WordPress plugin. Google Analytics shows which pages users are viewing. I want to drive users to contact me, and I’d like to get information on how many people are doing that. But because it’s an AJAX form (ie, submits the data via Javascript), Google Analytics doesn’t register an additional page view. You have to “tell” it to do that. At first I …

Finding beautiful images for your WordPress posts

David Nash content generation, wordpress Leave a Comment

Humans are visual creatures. If there’s a nice image to go along with your words, people are more likely to read them. We can look at an image and very quickly judge whether the article is worth reading. However there’s a problem – copyright. Photographers work hard to create their images and most would like income for them, and get understandably upset when you download them and use them on your post without crediting them. Fortunately there are some photographers who aren’t in it purely for the money. They’ll allow you to use their images as a way of getting publicity. …

Why WordPress sucks

David Nash wordpress 37 Comments

Why would I say such a thing? I’m a WordPress developer! Here’s the thing: I’m a realistic WordPress developer. I think it’s more important to know the things that are wrong with something you love so that you can work around with them. When I say WordPress sucks, what I really mean is that it’s the best, but nothing is perfect. It’s not a real CMS It’s really good for creating post and page content. But if the site you’re creating needs a gallery of team members, each with a bio, and displayed in various ways around the site, it’s a pain. You’d need …