Skip to content

Instantly share code, notes, and snippets.

View jeffcdavis's full-sized avatar
👨‍💻

Jeff Davis jeffcdavis

👨‍💻
View GitHub Profile
@jeffcdavis
jeffcdavis / hybrid_content_template-filter.php
Last active August 29, 2015 14:03
Filter hook for hybrid_content_template
<?php
add_filter( 'hybrid_content_template', 'my_content_template' );
function my_content_template( $template ) {
if ( is_front_page() ) {
$has_template = locate_template( array( 'content-feature.php', 'content/feature.php' ), false, false );
if ( $has_template )
@jeffcdavis
jeffcdavis / excerpt.php
Last active August 29, 2015 14:03
Custom WordPress excerpt length and read more link
<?php
function custom_read_more() {
return '&nbsp;<a class="read-more" href="'.get_permalink(get_the_ID()).'">[&#8230;]</a>';
}
function excerpt($limit) {
return wp_trim_words(get_the_excerpt(), $limit, custom_read_more());
}
/*
use excerpt(25) or whatever length you would like
@jeffcdavis
jeffcdavis / backup-mssql.asp
Created March 15, 2013 01:45
If you need to run scheduled backups of a shared hosting MSSQL database. You can easily run a cron job on the following ASP script. May come in handy if you work with MSSQL databases or support older code.
<%
dim thismonth, thisday, thisyear, location, filelename, ver, extention, abolutespath
thismonth= datepart("m", now())
thisday=datepart("d", now())
thisyear=datepart("yyyy",now())
location="\\full-path-to-your-backup-folder\backup\"
filename="dbBackup-" & thismonth & "-" & thisday & "-" & thisyear & "_"
ver=1
@jeffcdavis
jeffcdavis / include-wordpress.php
Created March 15, 2013 01:28
Load WordPress database/functions outside of WordPress
<?php
// Include WordPress
define('WP_USE_THEMES', false);
require('/website-root-directory/wp-load.php');
?>