This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Put this at the top of your functions.php file | |
// Force users to login... | |
add_action( 'template_redirect', 'force_login' ); | |
function force_login () { | |
if ( ! is_user_logged_in() ): | |
// Redirect to the login screen | |
header( 'Location: /wp-login.php?redirect_to=/' ); | |
die(); | |
endif; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="content"> | |
<article> | |
<p>Cras mattis consectetur purus sit amet fermentum. Donec ullamcorper nulla non metus auctor fringilla. Nullam id dolor id nibh ultricies vehicula ut id elit. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Maecenas sed diam eget risus varius blandit sit amet non magna. Cras justo odio, dapibus ac facilisis in, egestas eget quam.</p> | |
<aside class="left"> | |
<p>Cras mattis consectetur purus sit amet fermentum. Donec ullamcorper nulla non metus auctor fringilla. Nullam id dolor id nibh ultricies vehicula ut id elit. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Maecenas sed diam eget risus varius blandit sit amet non magna. Cras justo odio, dapibus ac facilisis in, egestas eget quam.</p> | |
</aside> | |
<p>Cras mattis consectetur purus sit amet fermentum. D |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// libsass (v3.1.0) | |
// ---- | |
// =================================== | |
// Grid settings | |
// =================================== | |
$gutter:15px; | |
$grid-columns:12; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<image-gallery> | |
<img src="http://lorempixel.com/500/250/" slot="photo" alt="Lorem pixel image"> | |
<p slot="caption">Image courtesy of lorem pixel</p> | |
</image-gallery> | |
<template id="image-gallery-markup"> | |
<style> | |
:host { | |
position: relative; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Pagination example | |
*/ | |
global $wp_query; | |
$big = 999999999; // need an unlikely integer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function simple_copyright () { | |
return "© " . get_bloginfo('name') ." ". date("Y"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Rems with pixel fallback for any property | |
// @author @BPScott (https://github.com/BPScott/bpscott.github.io/blob/develop/source/stylesheets/vendor/_rem.scss) | |
@mixin rem($property, $px-values, $baseline-px: $base-font-size) { | |
// Convert the baseline into rems | |
$baseline-rem: $baseline-px / 1rem; | |
// Create an empty list that we can dump values into | |
$rem-values: (); | |
@each $value in $px-values { | |
// If the value is zero, return 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Template Name: Homepage | |
*/ | |
$blog = new WP_Query('category_name=articles&posts_per_page=1'); | |
// $featured_products = new WP_Query('category_name=featured&posts_per_page=10'); | |
// Change to: | |
$featured_products = get_posts('category_name=featured&posts_per_page=10'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Define the arguements as you would for a WP_Query | |
$args = "whatever"; | |
// Run get_posts instead of WP_Query, does a similar thing but now $slide_posts | |
// will contain the query results in an array... | |
$slide_posts = get_posts($args); | |
// FOR LOOP! | |
// 3 arguments (counter), (the test to see how many loops to run - for as long as i < the count of the array) (increment counter) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Perform the get meta inside the condition of the if statement, | |
// it will return true if there's a value, false if not, | |
// and if true the $meta variable will be set to the meta value | |
if( $meta = get_post_meta($post_id, 'meta_name', true) ): | |
echo $meta; | |
else: | |
// Do something else | |
endif; | |
?> |
NewerOlder