Skip to content

Instantly share code, notes, and snippets.

View leftlane's full-sized avatar

Shawn Hesketh leftlane

View GitHub Profile
@leftlane
leftlane / functions.php
Created August 1, 2017 16:33
Custom function to pull in the video on a lesson page on WP101.com
function lesson_get_video_tutorial() {
if ( 'lesson' === get_post_type() ) {
$lesson = new LLMS_Lesson( get_the_ID() );
$display = false;
if ( $lesson->is_free() ) {
$display = true;
@leftlane
leftlane / single-tutorials.php
Created August 1, 2017 16:29
Custom Single Lesson Page Layout used on WP101.com
<?php
/*
* This file adds the custom tutorial post type single post template.
*/
//* Add custom body class to the head
add_filter( 'body_class', 'centric_add_body_class' );
function centric_add_body_class( $classes ) {
$classes[] = 'centric-pro-tutorial';
@leftlane
leftlane / add_meta_key_manually.php
Created June 12, 2012 06:37
Add a meta_key to all WordPress users of Subscriber Role using add_user_meta
<?php // Create the WP_User_Query object
$wp_user_query = new WP_User_Query( array( 'role' => 'subscriber' ) );
// Get the users
$users = $wp_user_query->get_results();
// Check for users
if (!empty($users))
{
// Loop through each user
foreach ($users as $user)
{