Skip to content

Instantly share code, notes, and snippets.

@nickdavis
nickdavis / style.css
Created February 5, 2015 10:15
Align Post Info alongside Entry Title on Home Top Featured widget area of News Pro theme by StudioPress
.home-top .featured-content .entry-header .entry-meta,
.home-top .featured-content .entry-title {
float: left;
}
.home-top .featured-content .entry-title {
padding-right: 10px;
}
@nickdavis
nickdavis / functions.php
Created February 11, 2015 21:05
Remove blog section from homepage of Education Pro theme by StudioPress
<?php
// Add this to your functions.php file, excluding the opening <?php
add_action( 'wp_head', 'nd_remove_homepage_blog' );
// Remove blog section from homepage
function nd_remove_homepage_blog() {
if ( is_front_page() || is_home() ) {
remove_action( 'genesis_loop', 'genesis_do_loop' );
}
}
@nickdavis
nickdavis / geoip.php
Created February 12, 2015 14:26
Correction of WP Engine GeoIP example code on http://wpengine.com/support/geoip-personalizing-content-based-geography/ (taken from the geoip.php file of the plugin itself)
<?php
function geoip_append_content( $content ) {
$geo = WPEngine\GeoIp::instance();
$content .= "How's the weather in {$geo->city()}, {$geo->region()} {$geo->country()}?<br /><br />";
return $content;
}
add_filter( 'the_content', 'geoip_append_content' );
@nickdavis
nickdavis / wp-config.php
Created February 17, 2015 17:25
Disable Post Revisions in WordPress via wp-config.php file
<?php
// Do NOT include the opening php tag
define( 'WP_POST_REVISIONS', false );
@nickdavis
nickdavis / gist:91eb2a338d4954b0f02a
Created March 20, 2015 09:48
Set a link to open in a new window / tab (target="_blank") with jQuery
jQuery(function( $ ){
$(".home-row4 a").attr("target","_blank");
});
@nickdavis
nickdavis / functions.php
Last active April 27, 2018 05:28
Using default WordPress next / prev post links check if one exists first and update CSS classes accordingly [not complete code]
<?php
// @link http://www.jaredatchison.com/code/add-next-previous-post-links-genesis/
// Check if there are next or previous posts
// First paramter is 'in_same_term'?, make sure it matches third parameter in previous_post_link / next_post_link (which defaults to false)
$next = get_adjacent_post( false, '', false );
$previous = get_adjacent_post( false, '', true );
//Set up CSS styles to know if there are next or previous posts only
@nickdavis
nickdavis / template-iframe.php
Created August 10, 2015 07:55
Modification of https://gist.github.com/nickdavis/ac2f20d9821303c390e9 to use a fixed URL for the iframe instead of a custom field
<?php
// Template Name: iFrame
/**
* The URL of what you want to appear in the iframe
*/
$url = 'http://nickdavis.co/full-page-iframe-template-genesis-wordpress/';
/**
* Display a full page iFrame and strip out all other content on the page
*
* @link http://www.dev-explorer.com/articles/full-page-iframe
@nickdavis
nickdavis / footer-credits-text.html
Created October 4, 2015 14:39
Example Footer Credits Field text as used in the Genesis Simple Edits plugin of the Milton theme demo site. See instructions: https://leanthemes.co/setup/milton/#footer-text
@nickdavis
nickdavis / footer-logo.html
Created October 4, 2015 15:41
HTML to be used in a Text Widget in the Footer 1 widget area to show a logo in the footer area of the Milton theme. See instructions: https://leanthemes.co/setup/milton/#footer-logo
@nickdavis
nickdavis / sponsored-by.html
Created October 4, 2015 18:27
Example HTML for the 'Sponsored by' (Text) widget used in the Primary Sidebar of the Milton theme demo website. Full instructions: https://leanthemes.co/setup/milton/#sidebar
<a href="https://leanthemes.co/themes/milton/" target="_blank"><img src="http://demo.leanthemes.co/milton/wp-content/uploads/sites/5/2014/10/image-sponsored-by.png" alt="Milton theme" /></a>