Skip to content

Instantly share code, notes, and snippets.

@eclarrrk
eclarrrk / get-gravity-forms-entries.php
Last active May 29, 2022 22:46
Display Gravity Form entries into WordPress page template
<?php
/*
Official Gravity Forms documentation on get_entries() found here:
https://docs.gravityforms.com/api-functions/#get-entries
*/
/* Gravity Form ID. */
$form_id = '20';
/* Sorting options avalable but left blank for simplicity. */
@eclarrrk
eclarrrk / functions.php
Last active March 14, 2019 18:35
Style the WordPress login page
<?php
// Add styles to the login page
function login_css() { ?>
<style type="text/css">
/* Change the WP logo to your own */
#login h1 a, .login h1 a {
background-image: url('<?php echo get_stylesheet_directory_uri(); ?>/path/to/logo.png');
height: 150px;
width: 150px;
@eclarrrk
eclarrrk / responsive-font-size-mixin.scss
Last active April 14, 2022 20:07
Responsive Font Size Sass Mixin
// settings
$remBase: 16; //set base font size. unitless value in pixels.
$widthMin: 480; //set small breakpoint. unitless value in pixels.
$widthMax: 1024; //set large breakpoint. unitless value in pixels.
@mixin font-size($valueMin, $valueMax) {
// turn mixin parameters into rem value.
$fontMin: $valueMin * $remBase;
$fontMax: $valueMax * $remBase;
@eclarrrk
eclarrrk / functions.php
Last active February 20, 2019 18:28
Wide and Full-width Gutenberg block options
<?php
// Register support for Gutenberg wide images in your theme
function mytheme_setup() {
add_theme_support( 'align-wide' );
}
add_action( 'after_setup_theme', 'mytheme_setup' );
@eclarrrk
eclarrrk / rrr-form-styles.scss
Created February 11, 2019 14:56
RRR form style tweaks for M6
.forms li input, .forms li textarea {
font-size: 16px; // was 15px
padding: .66em 1em; // was 15px
}
form#form-vlc-race-registration label.field_label {
margin: 1em 0 0 0; // was 16px 0 3px 0
}
form#form-vlc-race-registration h2 {
@eclarrrk
eclarrrk / wp-get-image-URL-w-size.php
Last active January 8, 2019 21:02
Get the URL for a specific size of an attachment image
<?php
$size = 'large';
$image_ID = get_field('field_name'); // when using ACF, choose 'Image ID' for return value
$image_array = wp_get_attachment_image_src($image_ID, $size);
$image_URL = $image_array[0];
echo $image_URL;
?>
@eclarrrk
eclarrrk / wp-custom-responsive-image-markup.php
Last active February 27, 2019 21:06
Snippet for creating responsive images while controlling scrset values.
<?php
$imageID = get_sub_field('img_id'); // ACF should return image ID
$size = 'full';
?>
<img
class="jetpack-lazy-image"
src="<?php echo wp_get_attachment_image_url( $imageID, '$size' ) ?>"
srcset="<?php echo wp_get_attachment_image_srcset( $imageID, '$size' ) ?>"
sizes=" (min-width: 1400px) 800px,
// Meat Monthly //
<div id="bbox-root" class="form"></div>
<script type="text/javascript">
window.bboxInit = function () {
bbox.showForm('458c52ea-a95b-478e-8b49-7346b1779a45');
};
(function () {
var e = document.createElement('script'); e.async = true;
e.src = 'https://bbox.blackbaudhosting.com/webforms/bbox-min.js';
@eclarrrk
eclarrrk / functions.php
Last active June 27, 2018 17:12
Generate responsive images in WordPress using the wp_get_attachment_image() function.
<?php
// Add a custom image size using the following function.
add_image_size( 'image-size-name', $imageWidthInPixels);
// Examples:
// Resized to 300px wide by proportionbal height.
add_image_size('headshot', 300);
// must come after wp_footer();
var elem = document.querySelector("#masthead");
var headroom = new Headroom(elem, {
"offset": 100,
"tolerance": 8,
"classes": {
"initial": "headroom",
"pinned": "headroom--is-pinned",
"unpinned": "headroom--is-hidden"
}