Skip to content

Instantly share code, notes, and snippets.


Drew Poland bmoredrew

View GitHub Profile
View acf-wrapper-functions.php
* Return a custom field stored by the Advanced Custom Fields plugin
* @global $post
* @param str $key The key to look for
* @param mixed $id The post ID (int|str, defaults to $post->ID)
* @param mixed $default Value to return if get_field() returns nothing
* @return mixed
* @uses get_field()
mattradford / acf_get_directions.php
Last active Aug 11, 2022
ACF Get Directions map link
View acf_get_directions.php
$location = get_field('map_location');
if ( !empty( $location ) ) :
$map_url = '' . $location['lat'] . ',' . $location['lng'];
echo '<a href=". esc_url( $map_url ) . '" rel="nooopener">Get directions</a>';
<p>This should produce a link like this:</p>
<a href=",1.088130">Get directions</a>
barbwiredmedia / functions.php
Last active Jun 7, 2022
Wordpress SEO Yoast Order meta box. This will change the priority of Yoasts meta box and move it to the bottom of all pages / posts.
View functions.php
// Move Yoast Meta Box to bottom
function yoasttobottom() {
return 'low';
add_filter( 'wpseo_metabox_prio', 'yoasttobottom');
morganestes / WordPress get_the_ID()
Last active May 16, 2021
Get the WordPress post ID no matter where you are.
View WordPress get_the_ID()

This extends the built-in WordPress function get_the_ID() to return the post ID both inside and outside the loop.

Used outside the loop (in header.php):

<?php if ( function_exists( 'gt_hide_nav' ) && ! gt_hide_nav() ) : ?>
  <nav role="navigation">
    <?php if ( function_exists( 'bones_main_nav' ) ) bones_main_nav(); ?>
View utm-redirect.php
function utm_welcome_redirect() {
// redirect anyone that is not logged in to /welcome
if ( !is_user_logged_in() )
wp_redirect( site_url( '/welcome' ), 303 );
View gist-shortcode-css.css
/* Optional CSS for themes that don't wrap the pre tag properly */
div.github-gist-block pre {
background-color: #F5F5F5;
border: 1px solid rgba(0, 0, 0, 0.15);
border-radius: 4px 4px 4px 4px;
display: block;
font-size: 13px;
line-height: 20px;
margin: 0 0 10px;
padding: 9.5px;
lucasfais / gist:1207002
Created Sep 9, 2011
Sublime Text 2 - Useful Shortcuts
View gist:1207002

Sublime Text 2 – Useful Shortcuts (Mac OS X)


⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt