Skip to content

Instantly share code, notes, and snippets.

View mrwweb's full-sized avatar

Mark Root-Wiley mrwweb

View GitHub Profile
<?php
// Resuable instance of WP_Query with preset $args
class Extended_WP_Query extends WP_Query {
function __construct( $args = array() ) {
$args = wp_parse_args( $args, array(
// some $args go here for reuse
) );
@mrwweb
mrwweb / reset-rems
Created May 22, 2013 13:22
"Sanity-ize" REMs by setting them to 10px-baseline aka "Tiny Happy Pixels Dancing."
/* this is the "root" in "root em." */
html {
font-size: 62.5%; /* Now 10px = 1rem! */
}
body {
font-size: 16px; /* px fallback */
font-size: 1.6rem; /* default font-size for document */
line-height: 1.5; /* a nice line-height */
}
@mrwweb
mrwweb / hide_yoast_seo_meta.php
Created June 1, 2013 20:49
Hide Yoast SEO Metabox via Screen Options by Default for New Users
// Hide Yoast SEO by Default
function hide_yoast( $hidden ) {
$hidden[] = 'wpseo_meta';
return $hidden;
}
add_filter( 'default_hidden_meta_boxes', 'hide_yoast' );
@mrwweb
mrwweb / readme.md
Last active December 18, 2015 10:28
Two helper functions to handle common use-cases for outputting fields created with Advanced Custom Fields.
@mrwweb
mrwweb / wordpress_posts_list.php
Created June 12, 2013 23:29
A function to output a delimited list of posts given an array of IDs in WordPress
<?php
/**
* Make a list of links to WordPress posts
*
* Works great with the Relationship field from Advanced Custom Fields
*
* @param array $posts array of post objects or post_ids
* @param string $sep separater
* @param string $before output before the list
* @param string $after output after the list
@mrwweb
mrwweb / functions.php
Created September 20, 2013 00:19
Jetpack Buggy Featured Content Code
<?php
add_image_size( 'wcp-front-feature', 440, 300, true );
add_theme_support( 'featured-content', array(
'featured_content_filter' => 'wcp_featured_posts',
'max_posts' => 2,
) );
function wcp_get_featured_posts() {
function flexslider_hg_admin_icon()
{
echo '
<style>
/*
Selectors:
1. Admin Menu
2. "Site Content" Dashboard Widget (Post Types only)
*/
#adminmenu #menu-posts-slides div.wp-menu-image:before,
@mrwweb
mrwweb / Title Attribute.html
Created January 21, 2014 16:33
Link with Title Attribute
<a href="http://google.com" title="Google">Google</a>
@mrwweb
mrwweb / mrw-tinymce-filter-example.php
Last active September 1, 2022 19:11
A plugin to modify the TinyMCE editor in WordPress 3.9+. Now available on WP.org! https://wordpress.org/plugins/mrw-web-design-simple-tinymce/
<?php
/**
* Example filter to add text style to TinyMCE filter with Mark's "MRW TinyMCE Mods" plugin
*
* Adds a "Text Styles" submenu to the "Formats" dropdown
*
* This would go in a functions.php file or mu-plugin so you don't have to modify the original plugin.
*
* $styles array Contains arrays of style_format arguments to define styles.
* Note: Should be an "array of arrays"
@mrwweb
mrwweb / append-file-types.css
Created June 9, 2014 14:33
CSS to automatically add a filetype to the end of a link. (e.g. "[PDF]") This is a best practice for accessibility and usability. Add or remove types as you see fit.
/* ID Link Mimetypes for Common Filetypes */
a[href$=".doc"]::after {
content: " [DOC]";
}
a[href$=".docx"]::after {
content: " [DOCX]";
}
a[href$=".rtf"]::after {
content: " [RTF]";