Skip to content

Instantly share code, notes, and snippets.

View rachelmccollin's full-sized avatar

Rachel McCollin rachelmccollin

View GitHub Profile
@rachelmccollin
rachelmccollin / body_class.php
Last active June 6, 2018 14:07
WPMU DEV body_class() and post_class() template tags
<body <?php body_class(); ?>>
@rachelmccollin
rachelmccollin / child_opening.css
Last active May 17, 2018 13:38
WPMU DEV code from child and parent themes
/*
Theme Name: LearnWP
Theme URI: http://rachelmccollin.com/
Description: Theme for Learn WP website. Child theme of compass framework
Author: Rachel McCollin
Template: compassframework
Version: 1.0
Tags: two-columns, fluid, responsive, mobile, custom-header, custom-background, threaded-comments, sticky-post, translation-ready, microformats, editor-style
*/
@rachelmccollin
rachelmccollin / code_full.php
Last active May 21, 2018 21:27
WMPU DEV display a random post from each category
<section class="random>">
<?php
$terms = get_terms( array(
'taxonomy' => 'category',
'parent' => 0
) );
$do_not_duplicate = array();
@rachelmccollin
rachelmccollin / WordPress_action_hook.php
Last active July 14, 2019 06:40
WPMU DEV Write and activate a function
add_action( 'wp_enqueue_scripts', 'wpmu_add_google_fonts' );
@rachelmccollin
rachelmccollin / archive_edits.php
Last active April 29, 2018 00:17 — forked from anonymous/style_comments.css
WPMU Create a WordPress theme from static HTML
<h2><?php the_archive_title(); ?></h2>
<?php get_template_part( 'includes/loop', 'archive' ); ?>
@rachelmccollin
rachelmccollin / dashboard_widget_function.php
Last active March 16, 2018 01:03
WPMU DEV Admin Messages
function rmcc_add_dashboard_widget() {
wp_add_dashboard_widget( 'rmcc_dashboard_welcome', 'Welcome', 'rmcc_welcome_widget_callback' );
}
add_action( 'wp_dashboard_setup', 'rmcc_add_dashboard_widget' );
@rachelmccollin
rachelmccollin / colophon_after.php
Last active February 13, 2018 14:55
WPMU DEV Landing pages
<section class="colophon" role="contentinfo">
<small class="copyright left">
<?php echo compass_copyright(); ?>
<?php if ( ! is_page_template ( 'landing-page.php' ) ) { ?>
<a href="<?php echo home_url( '/' ) ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home">
<?php bloginfo( 'name'); ?>
</a>
<?php } else {
<?php bloginfo( 'name'); ?>
@rachelmccollin
rachelmccollin / loop-page.php
Last active July 21, 2020 23:15
Ultimate guide to WordPress page templates
<?php
/*
The include for displaying the loop in static pages.
*/
if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php if ( is_front_page() ) { ?>
@rachelmccollin
rachelmccollin / Output_array.php
Last active January 17, 2018 14:05
WPMU DEV WordPress: Working with Arrays
echo '<p>Today&apos;s Favorite Things are <b>' . $favorite[0] . '</b> plus <b>' . $favorite[1] . '</b> and a bit of <b>' . $favorite[2] . '</b> . The upsides are ' . $best[0] . ' and ' . $best[1] . ', but the downside is ' . $worst[2] . '.</p>';
@rachelmccollin
rachelmccollin / customizer_function.php
Last active December 22, 2017 12:39
WPMU DEV Adding Styling via the Customizer Without Adding CSS to the Page
<?php
function wpmu_customize_register( $wp_customize ) {
}
add_action( 'customize_register', 'wpmu_customize_register' );