Skip to content

Instantly share code, notes, and snippets.

Avatar
👀
Looking for Opportunities

Andrew Magill andymagill

👀
Looking for Opportunities
View GitHub Profile
View Remove Wordpress Layout Support
// remove terrible experimental layout support
remove_filter( 'render_block', 'wp_render_layout_support_flag', 10, 2 );
function understrap_experimental_layout( $metadata ) {
if ( !empty($metadata['supports']['__experimentalLayout'])) {
$metadata['supports']['__experimentalLayout'] = false;
}
return $metadata;
}
add_filter( 'block_type_metadata', 'understrap_experimental_layout', 10, 1 );
View marketo-form-overrides.scss
// marketo form overrides
// from https://jennamolby.com/how-to-create-responsive-marketo-forms/
.mktoForm {
&,
.mktoLabel ,
.mktoHtmlText ,
.mktoFormRow,
View Init responsive carousel
@andymagill
andymagill / .htaccess
Last active Dec 11, 2022
HTACCESS rewrite rule not working on SiteGround
View .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# don't rewrite anything in docs folder to wordpress
RewriteCond %{REQUEST_URI} !^/(docs/*) [NC]
@andymagill
andymagill / remove_nav_classes.php
Created Nov 19, 2019
Remove injected classes and ID's from navigation - WordPress
View remove_nav_classes.php
<?php
// Remove Injected classes, ID's and page ID's from navigation <li> items
function remove_nav_classes( $var ) {
if ( is_array( $var ) ) {
foreach ( $var as $key => $val ) {
if ( strpos( $val, 'item' ) > -1 && $val != 'current-menu-item' ) {
unset( $var[$key] );
}
@andymagill
andymagill / gulpfile.js
Last active Nov 10, 2019
Bugged gulp file, generates css in scss folder
View gulpfile.js
var gulp = require("gulp");
var sass = require("gulp-sass");
var sourcemaps = require('gulp-sourcemaps');
function styles() {
return (
gulp.src('scss/**/*.scss')
.pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
.pipe(sourcemaps.init())
@andymagill
andymagill / add_page_name_class.php
Last active Nov 10, 2019
Add unique class to body tag - WordPress
View add_page_name_class.php
<?php
// Add page name to body classes
function add_page_name_class($classes)
{
global $post;
if ( is_page() || is_singular() ) {
$classes[] = sanitize_html_class($post->post_name);
}
return $classes;
}
@andymagill
andymagill / message.php
Created Oct 11, 2018
Why does $message return as empty string ?
View message.php
<?php
$message = file_get_contents(__DIR__ . '/confirmation.html');
$replace = array(
'[site_url]' => get_site_url() . '/wp-content/themes/artists-working/img/email/',
'[email]' => $email,
'[event_id]' => $event_id,
'[address]' => $event_address
);
@andymagill
andymagill / gist:60ef259986fff30e71bb7633d763246e
Created Oct 11, 2018
Why does this return empty string ?
View gist:60ef259986fff30e71bb7633d763246e
$message = file_get_contents(__DIR__ . '/confirmation.html');
$replace = array(
'[site_url]' => get_site_url() . '/wp-content/themes/artists-working/img/email/',
'[email]' => $email,
'[event_id]' => $event_id,
'[address]' => $event_address
);
foreach ($replace as $placeholder => $info) {