Skip to content

Instantly share code, notes, and snippets.

View ahaywood's full-sized avatar

Amy Haywood Dutton ahaywood

View GitHub Profile
@ahaywood
ahaywood / functions.php
Created March 5, 2019 03:31
WP - Remove Gutenberg Editor
/**
* REMOVE GUTENBERG EDITOR
* Reference: https://kinsta.com/blog/disable-gutenberg-wordpress-editor/
*/
add_filter('use_block_editor_for_post', '__return_false');
@ahaywood
ahaywood / composer.json
Last active January 6, 2019 05:41
Composer Boilerplate
{
"name": "ahhacreative/PROJECTNAME",
"authors": [
{
"name": "Amy (Haywood) Dutton",
"email": "amy@ahhacreative.com"
}
],
"repositories": [
{
@ahaywood
ahaywood / image-and-video.php
Created November 9, 2018 21:02
Display Image and Video
<div class="fitvids">
<?php $video = get_field('testimonial_video');
$image = get_field('testimonial_image'); ?>
<?php if ($image && $video) { // image click to video ?>
<a href="#" class="js-video">
<img src="<?php echo $image; ?>" data-video="<?php echo $video; ?>">
</a>
<?php } else if ($video) { // video only ?>
@ahaywood
ahaywood / README.md
Last active November 7, 2018 21:18
JS: Scroll to Top

Requirements

Make sure you're including jQuery within the project.

Quick Use

The link that you want the user to click, trigger the scroll, needs to have a class of js-scroll-to-top:

<a href="#" class="js-scroll-to-top">Back to Top</a>

At the top of your page, right after the body tag, include an empty div with an ID of top:

@ahaywood
ahaywood / html-share-buttons.html
Created September 21, 2017 16:33 — forked from davidsneal/html-share-buttons.html
HTML Share Buttons
<!-- I got these buttons from simplesharebuttons.com -->
<div id="share-buttons">
<!-- Buffer -->
<a href="https://bufferapp.com/add?url=https://simplesharebuttons.com&amp;text=Simple Share Buttons" target="_blank">
<img src="https://simplesharebuttons.com/images/somacro/buffer.png" alt="Buffer" />
</a>
<!-- Digg -->
<a href="http://www.digg.com/submit?url=https://simplesharebuttons.com" target="_blank">
@ahaywood
ahaywood / wp-config.php
Last active May 29, 2018 01:40
PHP: WP - Config file for working with local-config.php
<?php
/**
* The base configurations of the WordPress.
*
* This file has the following configurations: MySQL settings, Table Prefix,
* Secret Keys, WordPress Language, and ABSPATH. You can find more information
* by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
* wp-config.php} Codex page. You can get the MySQL settings from your web host.
*
* This file is used by the wp-config.php creation script during the
<?php
define('DB_NAME', '');
define('DB_USER', '');
define('DB_PASSWORD', '');
define('DB_HOST', '' );
$table_prefix = 'wp_';
@ahaywood
ahaywood / CSS: Media Query - Smartphones (landscape)
Last active January 25, 2018 16:45
CSS: Media Query - Smartphones (landscape)
/* Smartphones (landscape) ----------- */
@media only screen and (min-width : 321px) {
/* Styles */
}
@ahaywood
ahaywood / comments.php
Created November 9, 2017 07:42
PHP - WP: Ah Ha Comments
<?php wp_list_comments(array(
'avatar_size' => '140',
'type' => 'comment',
'callback' => 'ahha_comments'
)); ?>
@ahaywood
ahaywood / page.php
Created November 7, 2017 00:46
WP: Three ways to display an image
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php // ACF
$image = get_field('extra_image');
var_dump($image);
?>
<img src="<?= $image['url']; ?>" alt="<?= $image['alt']; ?>">
<?php // FEATURED IMAGE >> IMAGE TAG