Category

Web Dev

Certbot won’t renew certificate

Posted on March 24, 2018 in Web Dev

Certbot wouldn’t renew the cert for my domain. I decided to venture into the certbot config files (/etc/letsencrypt/ by default) and remove the renewal file so that I could reinstall the cert from scratch: rm /etc/letsencrypt/www.joetannorella.com.conf However, when trying to reinstall a cert again (certbot renew), I was getting this: renewal config file {} is…

Custom template for custom post type single post wordpress

Posted on January 22, 2017 in Web Dev

I recently had a somewhat unique situation whereby I needed a custom template per post of a custom post type. Consider the custom post type being ‘services’, then you’d set it like this: The URL structure follows something like: /services/web-development /services/consulting /services/cooking …and so on. In this example, I was looking to have a drastically different…

WordPress AJAX tutorial – how to use AJAX in a WordPress theme or template

Posted on June 19, 2016 in Web Dev

Edit: the output of this tutorial can be seen with the ‘agree’ and ‘disagree’ buttons here: http://www.youthenme.com/sites/review/ I’m fairly experienced with using AJAX and its various jQuery shorthand implementations, but having never implemented AJAX into a WordPress theme I’ve had to do quite a bit of Googling. I’m writing this post to show how I’ve implemented AJAX into…

WordPress Fatal error: Call to undefined function get_header() [fix]

Posted on July 6, 2015 in Web Dev

This problem seemed to come out of nowhere and was driving me crazy for at least 15 minutes. This is the error message I was getting (I have redacted and edited a few directories of this for privacy): Fatal error: Call to undefined function get_header() in /link/to/wordpress/install/public_html/wordpress_root/index.php on line 17 The problem was occuring on a pretty…

WordPress custom post type file not found 404

Posted on June 8, 2015 in Web Dev

This bothered me for way too long before actually discovering the solution. The solution is written there in plain English within the register_post_type array, yet I didn’t think to fiddle with it. The problem was regardless of permalinks settings, my single custom post type would always 404. It didn’t matter if I used the default…

How to seed a database in Laravel 5 (without the “[ReflectionException] Class ____ does not exist” error)

Posted on February 24, 2015 in Web Dev

Database seeding in Laravel is pretty awesome. It had me pondering recently what the best practice is for seeding a database with an admin user (or users). During my development I run into a slight issue. I felt like the Laravel docs didn’t fully explain the process, so I’m going to show you my solution…

Laravel 5 Entrust (Zizaco) error “Class ‘Role’ not found”

Posted on February 24, 2015 in Web Dev

I was having this problem for a good 30 mins until it finally hit me. Something glaringly obvious to any seasoned Laravel dev, or anyone with more than a few weeks experience in Laravel 5 for that matter, but a fairly easy thing to miss for a newbie to the L5 way of doing things. I was…

jQuery clone inputs and selects not working

Posted on November 24, 2014 in Web Dev

Use clone(true) to attach handlers to all new inputs. Kinda like updating the DOM.   If you don’t do this, your cloned selectors won’t have any JS handlers attached to them and will for all intents and purposes not be contained within the DOM.

Redirect non-www to www on Nginx server (+WordPress)

Posted on September 6, 2014 in Web Dev

Implementing a sitewide 301 isn’t particularly difficult. However, I kept hitting a redirect loop and just couldn’t figure out why. The problem was the URL as defined by WordPress was the non-www version, and not my desired www version. So, basically the server was redirecting from non-www to www, and then WordPress’ redirect was going…

SendGrid “Fatal error: Call to undefined function curl_init()” on DigitalOcean VPS

Posted on September 6, 2014 in Web Dev

This is another “dur” moment, but it’s worth jotting down for anyone else to find after they have the issue. Though, I’m not sure anyone else would have missed such an obvious problem! So as soon as I installed SendGrid on to my Digital Ocean VPS, all the backend stopped working. I changed over to WP_DEBUG=TRUE…