Advertisement
  1. Code
  2. Theme Development

Making a Theme With Bones: Finishing Off

Scroll to top
Read Time: 5 min

We are using a starter theme to build a new site.

We're going to follow straight on from the previous tutorial in this series. So let's jump into it:


Step 13: Setting Heading and Body Copy Fonts

We will use two fonts from the Google Font library: Arvo and PT Sans. Put this code in the functions.php file. This code will pull in the CSS code which contains the font-face properties.

1
2
function wptuts_googlefonts_styles() {
3
	// Enqueue the font stylesheets like this:

4
	wp_enqueue_style( 'googlefonts-arvo', 'http://fonts.googleapis.com/css?family=Arvo' );
5
	wp_enqueue_style( 'googlefonts-pt-sans', 'http://fonts.googleapis.com/css?family=PT+Sans' );
6
}  
7
add_action( 'wp_enqueue_scripts', 'wptuts_googlefonts_styles' );

Let's set Arvo for headings (base.less) and PT Sans for body copy. We can set the font with font-family. We also define serif and sans-serif which means we will get a default font if the custom font can't be loaded.

1
2
h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5 {
3
	font-family: 'Arvo', serif;
4
	...
5
}
6
7
...
8
9
body {
10
	font-family: 'PT Sans', sans-serif;
11
	...
12
}

Step 14: H1, footer, header

The font size will be 4em. We have to modify the footer.php to add content and the base.less file for styles. Set the background (with background), bottom border (with border-bottom) and padding (top 10px, 0px for left and right, and 15px for bottom). For the header a noise gradient resized by 10 times will be good, saved as a file (kotkoda_header_bg.gif) and it has to be in the bones/library/images folder. The CSS code goes into the base.less file. The graphics will be repeated horizontally (repeat-x) and start in the top left (0 0).

1
2
h1, .h1 {
3
	font-size: 4em; /*2.5em*/
4
	line-height: 1.333em;
5
}
1
2
<p class="attribution">&copy; <?php echo date('Y'); ?> <?php bloginfo('name'); ?>.
3
This page is protected by the <em>XXYY government and army</em>.
4
Read everything carefully.
5
You can reach us by mail at <strong>kukori @ kotkoda.com</strong>.
6
</p>
1
2
.footer {
3
	clear: both;
4
	background: #f6f6f6;
5
	border-bottom: 5px solid #FFD400;
6
	padding: 10px 0 15px;
7
}
1
2
.header {
3
	background: url(../images/kotkoda_header_bg.gif) 0 0 repeat-x;
4
}

This is how it looks after modifying the footer.

After footer modificationsAfter footer modificationsAfter footer modifications

This is how it looks after adding the graphics.

After footer modificationsAfter footer modificationsAfter footer modifications

Step 15: Favicon and Page Title

We can set a new 16x16 favicon in the header.php file. In the href part we set the path of the icon, get_template_directory_uri will give us the template's main directory URL. For the page title, replace the original code with this one and set the description in the admin interface. This PHP code will echo the blog's description field.

1
2
<link rel="shortcut icon" href="<?php echo get_template_directory_uri(); ?>/library/images/kotkoda_favicon.ico">
3
...
4
<title><?php echo get_bloginfo( 'description', 'display' ); ?></title>

It will look like this after adding the icon.

After adding the favicon

Step 16: Page Menu

The main navigation for pages will get a minimal style as well. With display set to inline the look will be horizontal and the left border will be white (border-left).

1
2
.menu {
3
	border-left: 1px solid @white;
4
	padding-left: 1em;
5
}
6
7
.menu ul {
8
	padding: 1em 0 1em;
9
	height: 1.5em;
10
}
11
12
.menu ul li {
13
	display: inline;
14
	margin-right: 1em;
15
}

The new look of the main menu.

After setting main menuAfter setting main menuAfter setting main menu

Step 17: Comment Styles

Comments will get a simpler look. The styles named odd and even should be empty (or commented out) and the li element gets a border-left. The right date text link will be white as well, let's color it to @white. The reply button will get a new style too. We have to set the color, the background color and the opacities (these are deleted).

1
2
.commentlist {
3
4
	li {
5
		position: relative;
6
		clear: both;
7
		overflow: hidden;
8
		list-style-type: none;
9
		margin-bottom: 1.5em;
10
		padding: 0.7335em 10px;
11
		border-left: 1px solid @white;
12
		
13
		...
14
		
15
		/* general comment classes */
16
		.alt {}
17
		.odd {
18
			/*background: #eee;*/
19
		}
20
		.even {
21
			/*background: #fefefe;*/
22
		}
23
24
...
25
	/* vcard */
26
	.vcard {
27
		margin-left: 50px;
28
29
		cite.fn {
30
			font-weight: 700;
31
			font-style: normal;
32
33
			a.url {}
34
35
		}
36
37
		time {
38
			float: right;
39
40
			a {
41
				color: @white;
42
			...
43
44
...
45
	/* comment reply link */
46
	.comment-reply-link {
47
		text-decoration: none;
48
		float: right;
49
		background: @white;
50
		padding: 3px 5px;
51
		color: #999;
52
		margin-bottom: 10px;
53
		font-weight: 700;
54
		font-size: 0.9em;
55
56
		&:hover,
57
		&:focus {
58
			color: @kotkoda-grey;
59
		}

The new look.

After comment modificationAfter comment modificationAfter comment modification

Step 18: Comment Box and Button

We don't need the border (border: 0) and the background should be @white (base.less). There are a lot of fancy styles we don't need (transition, rounded, gradient) so we have to change borders and backgrounds, and delete roundness and transition. This goes into our mixins.less file.

1
2
textarea {
3
	padding: 3px 6px;
4
	background: @white; /*#efefef;*/
5
	border: 0; /*2px solid #cecece;*/
6
}
1
2
.button, .button:visited {
3
	/*border: 1px solid darken(@kotkoda-grey, 13%);

4
	border-top-color: darken(@kotkoda-grey, 7%);

5
	border-left-color: darken(@kotkoda-grey, 7%);*/
6
	border: 0;
7
	padding: 4px 12px;
8
	color: #999;
9
	display: inline-block;
10
	font-size: 13px;
11
	font-weight: bold;
12
	text-decoration: none;
13
	/*text-shadow: 0 1px rgba(0,0,0, .75);*/
14
	cursor: pointer;
15
	margin-bottom: 20px;
16
	line-height: 21px;
17
	/*.transition();*/
18
	/*.rounded(4px);*/
19
	/*.css-gradient(#999,darken(#999, 5%));*/
20
21
	&:hover, &:focus {
22
		color: @kotkoda-grey;
23
	  	/*border: 1px solid darken(@kotkoda-grey, 13%);

24
	  	border-top-color: darken(@kotkoda-grey, 20%);

25
	 	border-left-color: darken(@kotkoda-grey, 20%);*/
26
		border: 0;
27
		/*.css-gradient(darken(#444, 5%),darken(#444, 10%));*/
28
	}
29
	
30
	&:active {
31
		/*.css-gradient(darken(@kotkoda-grey, 5%),@kotkoda-grey);*/
32
		color: @kotkoda-grey;
33
	}	
34
}

The look after styling.

After comment box and button modificationAfter comment box and button modificationAfter comment box and button modification

Step 19: Info Box

Let's change the info box background to light yellow, which is @alert-yellow (in mixins.less). We don't need a border, so set it to zero.

1
2
.info { 
3
	/*border-color: darken(@alert-blue, 5%); */
4
	border: 0;
5
	background: @alert-yellow;
6
}

Step 20: Theme Admin Screenshot

The last step is to delete the default screenshot and replace with the Kotkoda one we made.

Final theme screenshot for admin

Finished

Here is how the theme looks finished in 600 pixels wide. In the next tutorials we will clean the theme from unnecessary parts then prepare it for submission to ThemeForest.

After comment box and button modificationAfter comment box and button modificationAfter comment box and button modification
Advertisement
Did you find this post useful?
Want a weekly email summary?
Subscribe below and we’ll send you a weekly email summary of all new Code tutorials. Never miss out on learning about the next big thing.
Advertisement
Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.