Skip to content

Instantly share code, notes, and snippets.

👀
Looking for Opportunities

Andrew Magill andymagill

👀
Looking for Opportunities
Block or report user

Report or block andymagill

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@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) {
You can’t perform that action at this time.