Since the last post, I have started the theme tinkering with this blog that is part of the first week of headless ds106
I just fished around the themes on wordpress.org you get to right inside the dashboard (Appearance — Themes — Install). I checked the option to show themes related to photoblogging, and took a play with the Snaps theme, which turns out to be a free one from one of my favorite theme houses, Graph Paper Press.
since I knew I would inevitably start modifying the theme, I set up a child theme by creating a directory in
/wp-content/themes I called 106snaps. IN that directory, I created a new styles.css file with the correct syntax to make it a child theme — essentially making sure the header info referred to the parent theme via the Template value:
This is the name of the directory that contains the parent theme. And then making sure we pick up the styles:[crayon-5b2a6cee5c643334301055/]
If you do this right, when you go to Appearance — Themes you can select your child theme.
I went inside the Theme Customizer, and changed the header color to a turquoise color, and uploaded one of my own photos to be the header background.
The menu colors are hardwired as colors in the parent theme CSS, so I used the color I had used in the header, and a lighter variant, and overrode the parent CSS by putting on my child theme style sheet:[crayon-5b2a6cee5c646798766513/]
You have to know a bit how the colors work for the menus- they are in html as a set if nested HTML lists.
I did my first post and ran into a challenge. The theme uses image from the post to generate the ones that appear on the front page, but there is no indication if it is extracted from an image used in the post, or if a Featured image needs to be explicitly set (experiment shows the latter). But when I used this, the image on the cover was a different aspect ratio then the boxes and ones seen on the theme demo.
Having been fiddling with this on another project, it seems to be a common shortfall of these themes which generate images for an index- it is using the thumbnail size of images created for all uploads, but the defaullt thumbnail size is 150 x 150. There is code they can have in a theme which changes the thumbnail size, but I just figured out the size of the boxes, and changed the Settings – Media option to make the thumbnails 240px wide by 318px high.
This only affects images uploaded after the setting changes; to back change other media, you will have to install the Regenerate Thumbnails plugin.
For my posts, I am uploading flickr images (rather then linking) so I can use uploads to be my thumbnails– once I have an image in my media library, I can use the feature image controls (bottom right of post editor), to select the same image I used in my post as my featured one:
That got me closer:
But all those black boxes bugged me- those were posts from last time I used this blog (Spring 2012) and were not really relevant. For now, I want the front page to show posts only in my Headless Tricks category.
More code fun. I needed to modify the main loop on index.php, which in basic fashion, shows the latest posts. I copied index.php from the parent theme to the child theme directory.
SO just before the line that starts the “Loop”, the series of actions it performs for each post[crayon-5b2a6cee5c649572619714/]
I add a command which tells WordPress to just pull the latest posts from my Headless 106 category (I find the category ID number from the Posts– Categories screen. The command
query_posts modifies the database query that fetches posts.
With this done, the only thing you will see on the front page are posts to my special category:
So here are the changes done up to now:
As soon as this post is published, the dog icon will push the cat one over to the right.
Not huge steps, but I do like to let WordPress know who is in charge!