Skip to content

Instantly share code, notes, and snippets.

View markhowellsmead's full-sized avatar

Mark Howells-Mead markhowellsmead

View GitHub Profile
/*
* Supposition v0.3a - an optional enhancer for Superfish jQuery menu widget
*
* Copyright (c) 2013 Joel Birch - based on work by Jesse Klaasse - credit goes largely to him.
* Special thanks to Karl Swedberg for valuable input.
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*/
<?php
/**
* Set blog, index, archive & post thumbnail sizes
*/
/* Blog */
function wpt_blog_thumbnail_width( $width ) {
return 150; //blog thumbnail width in pixels
}
add_filter( 'et_pb_blog_image_width', 'wpt_blog_thumbnail_width');
@markhowellsmead
markhowellsmead / mini-modernizr.html
Created July 4, 2018 06:49 — forked from tomblanchard/mini-modernizr.html
Mini Modernizr: I only ever use Modernizr mostly to check for JS and / or touch screen devices. This tiny piece of code will replace the classes which are on the `<html>` element `no-js` with `js` and `no-touch` with `touch`.
<script>!function(a,b){"use strict";b.documentElement.className=b.documentElement.className.replace("no-js","js"),("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)&&(document.documentElement.className=document.documentElement.className.replace("no-touch","touch"))}(window,document);</script>
@markhowellsmead
markhowellsmead / composer-wp-cli.md
Created April 29, 2018 09:32 — forked from neverything/comopser-wp-cli.md
Install composer and wp-cli on cyon.ch hostings with SSH access.

Cyon.ch/Hostpoint - Install composer & wp-cli

Composer

SSH into your server and stay in the home directory of the user.

Install composer using curl. Check if you have a bin directory in your user directory already, in case you do, omit the mkdir bin.

cd ~
@markhowellsmead
markhowellsmead / add-wordpress-settings-page.php
Created October 3, 2019 14:20 — forked from DavidWells/add-wordpress-settings-page.php
WordPress :: Add Settings Page with All Fields
<?php
/*
Plugin Name: Homepage Settings for BigBang
Plugin URI: http://www.inboundnow.com/
Description: Adds additional functionality to the big bang theme.
Author: David Wells
Author URI: http://www.inboundnow.com
*/
// Specify Hooks/Filters
@markhowellsmead
markhowellsmead / mark-parent-navigation-active.php Mark (highlight) post type parent as active item in Wordpress Navigation. When you visit a custom post type's single page, the parent menu item (the post type archive) isn't marked as active. This code solves it by comparing the slug of the current post type with the navigation items, and adds a class accordingly.
<?php
add_action('nav_menu_css_class', function ($classes, $item) {
// Getting the current post details
$post = get_queried_object();
if (isset($post->post_type)) {
if ($post->post_type == 'post') {
$current_post_type_slug = get_permalink(get_option('page_for_posts'));
@markhowellsmead
markhowellsmead / exif-gist.php
Created February 10, 2021 09:40 — forked from black-forever/exif-gist.php
EXIF 01 - Get EXIF-Information from wp_get_attachment_image_attributes
<?php
/**
* *****************************************************************************
* GIST - EXIF 01 - Get EXIF-Information from wp_get_attachment_image_attributes
* *****************************************************************************
*/
if ( is_attachment() ) {
$imgmeta = wp_get_attachment_metadata( $id );
@markhowellsmead
markhowellsmead / wp-config.php
Created June 17, 2021 16:50 — forked from MikeNGarrett/wp-config.php
All those damned wp-config constants you can never remember.
<?php
// PHP memory limit for this site
define( 'WP_MEMORY_LIMIT', '128M' );
define( 'WP_MAX_MEMORY_LIMIT', '256M' ); // Increase admin-side memory limit.
// Database
define( 'WP_ALLOW_REPAIR', true ); // Allow WordPress to automatically repair your database.
define( 'DO_NOT_UPGRADE_GLOBAL_TABLES', true ); // Don't make database upgrades on global tables (like users)
// Explicitely setting url
@markhowellsmead
markhowellsmead / set-filter-by-tax.php
Last active July 14, 2021 14:24 — forked from marushu/set-filter-by-tax.php
Supports multiple filters.
<?php
add_action('restrict_manage_posts', [$this, 'taxonomyFilter']);
add_filter('parse_query', [$this, 'filterByTaxonomy']);
public function taxonomyFilter()
{
global $typenow;
@markhowellsmead
markhowellsmead / iframe.js
Created September 30, 2021 08:13 — forked from wlarch/iframe.js
Overwrite/bypass <iframe></iframe> height limit imposed by Wordpress
/**
* Overwrite/bypass <iframe></iframe> height limit imposed by Wordpress
* Original idea from bypass-iframe-height-limit plugin by Justin Carboneau
* Adapted from original /wp-includes/js/wp-embed.js
*/
(function(window, document) {
'use strict';
var supportedBrowser = false;