Skip to content

Instantly share code, notes, and snippets.

View SteveRyan-ASU's full-sized avatar

Steve Ryan SteveRyan-ASU

  • Arizona State University, Fulton Schools of Engineering Communications (@fsoe-asu)
  • Tempe, AZ
View GitHub Profile
<!-- wp:paragraph -->
<p>This post will attempt to document all of the ways alignment can be assigned. Note that how the PAGE TEMPLATE is built that this content is shown on has much to do with how the items below will lay out. It is assumed that the post-content block in the template DOES have 'inherit layout' applied and is the top level container. </p>
<!-- /wp:paragraph -->
<!-- wp:heading -->
<h2 id="no-containing-it">No Containing It</h2>
<!-- /wp:heading -->
<!-- wp:paragraph -->
<p>This is a paragraph. It is a default paragraph inside no container. It should be the "regular" content with. When the window is WIDER than the "normal" width this paragraph block should be exactly as wide as the "normal width" is configured to be. When the window is anything smaller than that this paragraph should have space between it and the edge of the window.</p>
@kingkool68
kingkool68 / use-remote-media.php
Last active March 24, 2024 11:37
Check if a local file exists in the WordPress media library and if it doesn't exist, replace the URL with a different URL. Helpful when working with a local site that doesn't have all of the media downloaded as the production site. See https://localwp.com/community/t/proxying-requests-to-wp-content-uploads-to-a-production-site/15701
<?php
// Put this in wp-config.php and replace https://example.com/ with the URL of the production site.
define( 'RH_USE_REMOTE_MEDIA_URL', 'https://example.com/' );
// Put the rest of this in functions.php or a custom plugin or somewhere else.
if ( defined( 'RH_USE_REMOTE_MEDIA_URL' ) && ! empty( RH_USE_REMOTE_MEDIA_URL ) ) {
add_filter( 'wp_get_attachment_image_src', 'filter_wp_get_attachment_image_src' );
add_filter( 'wp_calculate_image_srcset', 'filter_wp_calculate_image_srcset' );
add_filter( 'wp_get_attachment_url', 'filter_wp_get_attachment_url' );
}
@techlemur
techlemur / list_blocks.js
Created February 11, 2019 21:19
get all available gutenberg block info for your site with javascript
/* Navigate to a wordpress edit page for any post and run one of the code sections below in a javascript console to get the names/info for all blocks available to gutenberg on your site. */
/* log all block info to console */
console.log(wp.data.select( "core/blocks" ).getBlockTypes());
/* log all block names to console */
wp.data.select( "core/blocks" ).getBlockTypes().forEach(function(element) {
console.log(element['name']);
});
@DavidPeralvarez
DavidPeralvarez / core-blocks.txt
Last active September 20, 2022 08:04
Gutenberg core blocks list
// Útil para filtros de Gutenberg como "allowed_block_types"
archives
audio
button
categories
code
column
columns
coverImage
@joelstransky
joelstransky / functions::acf_settings_load_json.php
Created May 10, 2017 02:25
Advanced Custom Fields acf-json support for child themes
<?php
/**
* Child theme support for acf-json
* This will load acf-json from the parent theme first.
* That way if a child theme's acf-json folder contains a .json
* file with the same name as the parent, it will get loaded second
*/
add_filter('acf/settings/save_json', function() {
return get_stylesheet_directory() . '/acf-json';
});
@neilgee
neilgee / addinfunctions.php
Last active January 30, 2023 20:34
Gravity Form Word Count
<?php
/* Gravity Forms Word Count Script */
function els_load_scripts() {
wp_enqueue_script('gravity-forms-word-count', get_stylesheet_directory_uri() . '/js/jquery.gravity_word_count.js', array('jquery'), '0.1', true);
}
add_action('wp_enqueue_scripts', 'els_load_scripts');
/*Then in the form, for fields that need the word count, add the class ‘els-word-count[300].' Change [300] as needed for the maximum words that can be added to that particular field.*/
/*Source http://www.gravityhelp.com/forums/topic/maximum-word-count#post-149331*/
@spigists
spigists / new_gist_file.css
Created October 2, 2013 16:16
Bootstrap 3 styles for Gravity Forms, make sure that in Forms > Settings you have Output CSS set to No and Output HTML5 set to Yes
.gform_wrapper ul {
padding-left: 0;
list-style: none; }
.gform_wrapper li {
margin-bottom: 15px; }
.gform_wrapper form {
margin-bottom: 0; }
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/