Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View goatboy91587's full-sized avatar

Brett Widmann goatboy91587

View GitHub Profile
@danielbachhuber
danielbachhuber / gist:7126249
Last active December 21, 2021 15:46
Include posts from authors in the search results where either their display name or user login matches the query string
<?php
/**
* Include posts from authors in the search results where
* either their display name or user login matches the query string
*
* @author danielbachhuber
*/
add_filter( 'posts_search', 'db_filter_authors_search' );
function db_filter_authors_search( $posts_search ) {
@mattradford
mattradford / acf_body_class.php
Last active September 18, 2020 20:30
Echo ACF custom field in body class
// ACF field added to body class
// Adapted from http://krogsgard.com/2012/wordpress-body-class-post-meta/
add_filter('body_class','tend_custom_field_body_class');
function tend_custom_field_body_class( $classes ) {
global $wp_query;
$postid = $wp_query->post->ID;
if ( is_page_template('template-service-index.php') ) {
@BurlesonBrad
BurlesonBrad / header-tracking-snippet.php
Created January 27, 2020 18:27
🚫No WordPress plugin needed to add tracking code to the header 👍
function header_tag_analytics() { ?>
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXXX-XX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-XXXXXXXX-XX');
</script>
// Add your Tweeder scripts Adroll scripts Facebook scripts BounceX scripts Optimizely scripts or whatever needs to be in the head