Skip to content

Instantly share code, notes, and snippets.

View wpspeak's full-sized avatar

WPSpeak wpspeak

View GitHub Profile
@wpspeak
wpspeak / functions.php
Created June 9, 2013 21:45
Add new featured image size
<?php
// Add new featured image size
add_image_size( $name, $width, $height, $crop );
?>
@wpspeak
wpspeak / functions.php
Created June 11, 2013 06:30
Add shortcode for search form in Genesis Framework
<?php
/**
* Search Shortcode Excerpt
* @since 1.1 Genesis 404 Page plugin
* @author Bill Erickson
*/
function search_shortcode() {
return '<div class="genesis-404-search">' . get_search_form( false ) . '</div>';
}
@wpspeak
wpspeak / functions.php
Last active December 18, 2015 08:39
Remove Pagination from CPT
<?php
// Remove Pagination from CPT
add_action('parse_query', 'cpt_nopaging');
function cpt_nopaging($query) {
if (is_post_type_archive('testimonies')) {
$query->set('nopaging', 1);
}
}
@wpspeak
wpspeak / functions.php
Created June 13, 2013 01:56
Set minimal character limit before comments being accepted
<?php
/*
* Set minimal character limit before comments being accepted
* @url: http://www.paulund.co.uk/set-minimal-comment-limit-in-wordpress
* /
add_filter( 'preprocess_comment', 'minimal_comment_length' );
function minimal_comment_length( $commentdata ) {
@wpspeak
wpspeak / functions.php
Created June 14, 2013 03:32
Add Jetpack infinite scroll support in Genesis Framework
<?php
// Add support for JetPack infinite scroll
function afn_infinite_scroll() {
add_theme_support( 'infinite-scroll', array(
'container' => 'content',
'footer' => 'footer',
'render' => 'genesis_do_loop'
) );
@wpspeak
wpspeak / functions.php
Last active December 18, 2015 11:59 — forked from anonymous/functions.php
<?php
// Removee "Protected" and "Private" from Protected and Private Posts
function afn_title_trim($title) {
$title = attribute_escape($title);
$findthese = array(
'#Protected: #', // Notice the blank space after Protected:
'#Private: #' // Notice again, otherwise the title get pushed.
);
@wpspeak
wpspeak / functions.php
Created June 14, 2013 20:16
Change submit button text in comment form
<?php
// Change submit button text in comment form
function afn_change_submit_button_text( $defaults ) {
$defaults['label_submit'] = 'Submit Comment';
return $defaults;
}
add_filter( 'comment_form_defaults', 'afn_change_submit_button_text' );
@wpspeak
wpspeak / functions.php
Created June 14, 2013 22:10
Load Google Custom Fonts
<?php
//* Do NOT include the opening php tag
//* Load Lato and Merriweather Google fonts
add_action( 'wp_enqueue_scripts', 'custom_load_google_fonts' );
function custom_load_google_fonts() {
wp_enqueue_style( 'google-font', 'http://fonts.googleapis.com/css?family=Lato:300,400|Merriweather:300,400', array(), PARENT_THEME_VERSION );
}
@wpspeak
wpspeak / style.css
Created June 15, 2013 03:47
Responsive image with caption
// Responsive image with caption in WordPress
.wp-caption {
margin-bottom: 1em;
margin-left: 0;
max-width: 96%;
text-align: center;
}
@wpspeak
wpspeak / functions.php
Created June 15, 2013 10:11
Use Typekit fonts in WordPress without plugin
<?php
/**
* TypeKit Fonts
* @since Theme 1.0
* @url http://wptheming.com/2013/02/typekit-code-snippet/
*
*/
function theme_typekit() {
wp_enqueue_script( 'theme_typekit', '//use.typekit.net/xxxxxxx.js');