Skip to content

Instantly share code, notes, and snippets.

View WebsiteStudents's full-sized avatar

WebsiteStudents WebsiteStudents

View GitHub Profile
@WebsiteStudents
WebsiteStudents / Code to create functions.php
Created March 29, 2014 22:31
Code to create a functions.php file in your child theme. This code will display the "page slug" for each page as a "class name" attached to the <body> tag.
<?php //Opening PHP tag
//Page Slug Body Class
function add_slug_body_class( $classes ) {
global $post;
if ( isset( $post ) ) {
$classes[] = $post->post_type . '-' . $post->post_name;
}
return $classes;
}
@WebsiteStudents
WebsiteStudents / WordPress custom page template code
Created March 29, 2014 21:13
Use this code to establish a custom page template for your WordPress theme.
<?php
/*
Template Name: My Custom Page
*/
get_header(); ?>
<div id="primary" class="site-content">
<div id="content" role="main">
@WebsiteStudents
WebsiteStudents / gist:9438551
Created March 8, 2014 20:41
CSS code that applies the hover state to all of our table rows that use a pseudo-class in their CSS rule. Note that this CSS rule replaces the existing "hover" state for every row (or "tr") in the table - which is the very first line of compoun selectors in the rule you see here.
.maincontainer table.zebra tr:hover,
.maincontainer table.zebra tr:nth-child(2n+2):hover,
.maincontainer table.zebra tr:nth-child(3n+3):hover,
.maincontainer table.zebra tr:nth-of-type(1):hover:not(.labels) {
background-color: #333333;
color: #FFFFFF;
}
@WebsiteStudents
WebsiteStudents / gist:9036082
Last active August 29, 2015 13:56
Final result of Part 2 in Week 6 that shows the HTML code to implement the "include files" into the page.
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Apollo 1 Tragedy - Week 6, Part 2</title>
<link href="styles.css" rel="stylesheet" type="text/css">
<style type="text/css">
</style>
@WebsiteStudents
WebsiteStudents / gist:8903516
Created February 9, 2014 18:19
Link to external CSS file
<link href="styles.css" rel="stylesheet" type="text/css">
@WebsiteStudents
WebsiteStudents / style.css code for child theme
Created April 1, 2013 21:26
Code to begin your WordPress Child Theme. Place this into a new file named "style.css" and load it into a new directory on the server. This new directory can have any name you desire, but try this: nova-child-theme
/*
Theme Name: TwentyTwelve Child
Description: Child theme for the TwentyTwelve theme
Author: [Your name here]
Template: twentytwelve
*/
@import url("../twentytwelve/style.css");
/* Begin your custom CSS below */
@WebsiteStudents
WebsiteStudents / CSS for first row color
Created March 19, 2013 17:13
CSS to change the background color of the first row. Place this after the __ comment.
/* CHANGE FIRST OF TYPE */
.maincontainer table.zebra tr:nth-of-type(1) {
background-color:#ff7373;
}
@WebsiteStudents
WebsiteStudents / CSS first row but not in the <thead>
Last active December 15, 2015 03:59
CSS code to change the background color of the first row but NOT inside the <thead> row. Place this after the /* INSERT PSEUDO-CLASS CODE BELOW */ comment.
/* CHANGE FIRST OF TYPE BUT NOT INSIDE THEAD ROW */
.maincontainer table.zebra tr:nth-of-type(1):not(.labels) {
background-color:#ff7373;
}
@WebsiteStudents
WebsiteStudents / CSS to change every third row
Last active December 15, 2015 03:59
CSS code to change the background color of every third row. Insert this after the /* INSERT PSEUDO-CLASS CODE BELOW */ comment.
/* CHANGE BACKGROUND COLOR OF EVERY THIRD ROW */
.maincontainer table.zebra tr:nth-child(3n+3) {
background-color: #c5c678;
}
@WebsiteStudents
WebsiteStudents / CSS to change only third row
Last active December 15, 2015 03:59
CSS code that changes the background color for only the third row. Place this inside your CSS after the /* INSERT PSEUDO-CLASS CODE BELOW */ comment.
/* CHANGE BACKGROUND COLOR OF ONLY THIRD ROW */
.maincontainer table.zebra tr:nth-child(3) {
background-color: #b00b00;
}