Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View lepittenger's full-sized avatar

Lauren Levin (Pittenger) lepittenger

View GitHub Profile
@lepittenger
lepittenger / bash.sh
Last active August 18, 2023 16:13
Linting PHP files
$ vendor/bin/phpcbf {filename}
$ vendor/bin/phpcs {filename}
@lepittenger
lepittenger / get-link-by-page-template-name.php
Last active August 18, 2023 16:02
Get link by page template name
@lepittenger
lepittenger / .htaccess
Created August 18, 2023 15:52
Load remote images locally
# Redirect WordPress uploads requests, to dev/prod server
RedirectMatch 301 ^/wp-content/uploads/(.*) https://mywebsite.com/wp-content/uploads/$1
@lepittenger
lepittenger / test-gutenberg-blocks.html
Created January 27, 2023 21:52
Test Gutenberg Blocks Content
<!-- wp:group {"backgroundColor":"vivid-red","textColor":"white","layout":{"type":"constrained"}} -->
<div class="wp-block-group has-white-color has-vivid-red-background-color has-text-color has-background"><!-- wp:paragraph -->
<p><strong>Each block type is on a separate page.</strong> </p>
<!-- /wp:paragraph -->
<!-- wp:paragraph {"fontSize":"small"} -->
<p class="has-small-font-size">Use the links at the bottom of this page to navigate between pages.</p>
<!-- /wp:paragraph --></div>
<!-- /wp:group -->
@lepittenger
lepittenger / Conditional orderby
Created December 29, 2021 16:47
Conditional Orderby
$order = '';
if ( sort_group = 1 ) {
$order = 'ASC';
}
if ( sort_group = 1 ) {
$order = 'DESC';
}
@lepittenger
lepittenger / page-cpts-grouped-by-taxonomy.php
Created July 31, 2017 02:14
Loop Through CPTs + Group by Custom Taxonomy Terms
<?php
/**
*
* Loop through some custom post types and group them by taxonomy term,
* outputting the taxonomy term names before the set of posts
*
*/
// get all of the custom taxonomy terms
$taxonomy = 'my_custom_taxonomy';
@lepittenger
lepittenger / youtube-thumbnail.php
Last active July 28, 2017 21:49
Display a YouTube Thumbnail
<?php
/**
*
* Display a YouTube video thumbnail based on a URL in a template
*
*/
$video_link = 'https://www.youtube.com/watch?v=B9duuy7lr08';
@lepittenger
lepittenger / page_blog.php
Created June 13, 2016 16:17
Genesis blog template with page content before posts
<?php
//* Template Name: Blog
//* Remove the blog heading which caused duplicate page title with the below standard loop
remove_action( 'genesis_before_loop', 'genesis_do_blog_template_heading' );
//* Show page content above posts
add_action( 'genesis_loop', 'genesis_standard_loop', 5 );
genesis();
@lepittenger
lepittenger / genesis-video-before-content.php
Last active September 22, 2017 19:11
Take a link from a video and embed it before the post content with Genesis
<?php
/**
* Add video from a custom field before the post content on single posts.
*/
add_action( 'genesis_entry_content','lp_video_before_entry_content_on_singles', 5 );
function lp_video_before_entry_content_on_singles() {
if ( is_singular() ) {
@lepittenger
lepittenger / mixins.scss
Last active March 15, 2016 19:48
most fav mixins
/* rem is only relative to the html element */
@function calculateRem($size) {
$remSize: $size / 16px;
@return $remSize * 1rem;
}
@mixin rem($size) {
font-size: $size;
font-size: calculateRem($size);
}