Customising a WordPress theme

I really like the Aldehyde theme when it updated and it’s standard blog view. Trouble is I couldn’t easily customise it via the GUI so I guess I’ll have to dive into the code.

After initial search it seemed prudent to create a child theme so any serious customisations don’t get lost after an update.

I have to say at the moment I have no idea where changes to a theme are kept when changing it via the GUI.

As I run my own server I can do a lot of the changes via a SSH session.

I create a new child theme directory in the /var/www/wp-content/themes/ directory and fill out the style.css file with:

/*
 Theme Name: My Child Theme
 Theme URI: http: //none.com/
 Description: This is a custom child theme I have created.
 Author: nullgenome
 Author URI: http: //rejected.io/
 Template: aldehyde
 Version: 0.1
 */
 @import url("../aldehyde/style.css");

As the link above explains, the Template part references the parent theme and the “@” line references the parent’s main style file, otherwise the child would show nothing when it’s activated.

What’s the reason why I wanted a child theme for customisations? Well the standard grid view comes with a small picture with the post entry that by default is blank. What’d be nice is to have a set picture relating to the subject of the post.

So as a test and following the following post I copy the source file:

/var/www/wp-content/themes/aldehyde/framework/layouts/content-grid

to:

/var/www/wp-content/themes/aldehyde_child01/framework/layouts/content-grid

I then download a NetApp corporate image from here and upload it via the WordPress uploading tool. The file then is place in the /var/www/wp-content/uploads/2015/06/ directory (I guess I could use SCP or something but CBA) and I then update the following line in the content-grid file from:

<a href="<?php the_permalink() ?>" title="<?php the_title() ?>"><img src="<?php
 echo get_template_directory_uri()."/assets/images/placeholder2.jpg"; ?>"></a>

to:

<a href="<?php the_permalink() ?>" title="<?php the_title() ?>"><img src="<?php echo get_template_directory_uri()."/../../uploads/2015/06/netapp.png"; ?>"></a>

This then successfully updates the image of all my post entries to the uploaded NetApp image.

Now how do I customise it based on post subject? (update to follow)….

UPDATE

It seems I didn’t need to do any of this and just use the Featured Image setting in each post, which I’ve pretty much done.

Leave a Reply

Your email address will not be published. Required fields are marked *