Skip to content

Instantly share code, notes, and snippets.

View derekshirk's full-sized avatar
🚙
Principal Product Designer at Driveway

Derek Shirk derekshirk

🚙
Principal Product Designer at Driveway
View GitHub Profile
@daltonrooney
daltonrooney / wp_custom_title_placeholder_text.php
Created September 24, 2015 18:46 — forked from isGabe/wp_custom_title_placeholder_text.php
WordPress: Custom placeholder text for custom post type title input box #snippet #WordPress
<?php
/*
replacing the default "Enter title here" placeholder text in the title input box
with something more descriptive can be helpful for custom post types
place this code in your theme's functions.php or relevant file
source: http://flashingcursor.com/wordpress/change-the-enter-title-here-text-in-wordpress-963
*/
@daltonrooney
daltonrooney / get_stores_by_location.php
Last active June 29, 2023 14:14
Store locator with Advanced Custom Fields
<?php
function mbn_get_stores_by_location( $zip, $radius ) {
global $wpdb;
$radius = intval( $radius );
// we first need to get the source coordinates
$sql = "SELECT `latitude`, `longitude` FROM `wp_zip_codes` WHERE `zipcode` = '%s'";
$coords = $wpdb->get_row( $wpdb->prepare( $sql, $zip ) );
@madeinnordeste
madeinnordeste / wp-strore-query-for-reuse.php
Last active August 29, 2015 14:00
Wordpress : Strore Query for reuse
<!-- saving the query -->
<?php $temp_query = clone $wp_query; ?>
<!-- listing out featured articles -->
<?php query_posts('category_name=featured&showposts=3'); ?>
<?php while (have_posts()) : the_post(); ?>
<!-- Do special_cat stuff... -->
<?php endwhile; ?>
@mapsam
mapsam / README.md
Created April 25, 2014 00:37
Inline SVG partial for WordPress

Good for acting on specific pieces of your SVG object instead of just link as an <img> you can bring the entire object into your HTML. You need two things:

  1. SVG file with a double extension ending with .php - e.g. logo.svg.php
  2. WP include statement with the built-in function get_template_part
<?php
get_template_part( 'includes/partials/logo', 'logo.svg' );
?>
@mustardBees
mustardBees / functions.php
Last active August 11, 2021 14:40
Filter a few parameters into WordPress YouTube oEmbed requests. Enable modest branding which hides the YouTube logo. Remove the video title and uploader information. Prevent related videos from being shown once the video has played.
<?php
/**
* Filter a few parameters into YouTube oEmbed requests
*
* @link http://goo.gl/yl5D3
*/
function iweb_modest_youtube_player( $html, $url, $args ) {
return str_replace( '?feature=oembed', '?feature=oembed&modestbranding=1&showinfo=0&rel=0', $html );
}
add_filter( 'oembed_result', 'iweb_modest_youtube_player', 10, 3 );
@elclanrs
elclanrs / email-confirmation.php
Last active July 26, 2022 00:11
Simple e-mail confirmation plugin for WordPress.
<?php
/**
* Plugin Name: Email Confirmation
* Description: Send an email to the user with confirmation code and store form data in database until user confirms.
* Author: Cedric Ruiz
*/
class EmailConfirmation
{
const PREFIX = 'email-confirmation-';
@johnregan3
johnregan3 / cpt_in_wp_submenu.php
Last active December 3, 2022 07:32
Add Custom Post Type to WordPress Plugin Submenu (Hack)
<?php
/*
Plugin Name: Nerfherder Plugin
Plugin URI: https://gist.github.com/johnregan3/6133389
Description: Demonstration of how to add Custom Post Types to Submenu Items
Author: John Regan
Author URI: http://johnregan3.com
Version: 1.0
*/
@wpscholar
wpscholar / replace-wp-dashboard.php
Last active June 25, 2024 08:31
Replace the default WordPress dashboard with a custom one
<?php
/**
* Plugin Name: Replace WordPress Dashboard
* Description: Replaces the default WordPress dashboard with a custom one.
* Author: Micah Wood
* Author URI: http://micahwood.me
* Version: 0.1
* License: GPL3
*/
@font-face {
font-family: 'EntypoRegular';
src: url('font/entypo.eot');
src: url('font/entypo.eot?#iefix') format('embedded-opentype'),
url('font/entypo.woff') format('woff'),
url('font/entypo.ttf') format('truetype'),
url('font/entypo.svg#EntypoRegular') format('svg');
font-weight: normal;
font-style: normal;
}