Skip to content

Instantly share code, notes, and snippets.

View wpspeak's full-sized avatar

WPSpeak wpspeak

View GitHub Profile
@wpspeak
wpspeak / tags-widget.php
Last active December 18, 2015 13:29
Customize WordPress Tag Cloud Widget
<?php
// Parameters accepted by tag cloud widget
// @url http://codex.wordpress.org/Function_Reference/wp_tag_cloud
$args = array(
'smallest' => 8,
'largest' => 22,
'unit' => 'pt',
'number' => 45,
@wpspeak
wpspeak / functions.php
Created June 16, 2013 06:33
Limit tag cloud widget to 20 items and order by count
<?php
// Limit tag cloud widget to 20 items and order by count
add_filter('widget_tag_cloud_args','set_number_tags');
function set_number_tags($args) {
$args = array('number' => 20, 'orderby' => 'count');
return $args;
}
@wpspeak
wpspeak / functions.php
Created June 16, 2013 06:42
Customize font-size of tag cloud widget
<?php
// Customize font-size of tag cloud widget
add_filter('widget_tag_cloud_args','set_number_tags');
function set_number_tags($args) {
$args = array('smallest' => 11, 'largest' => 11);
return $args;
}
@wpspeak
wpspeak / functions.php
Created June 16, 2013 08:56
Add shortcode for search form in WordPress
<?php
/*
* Add a shortcode for search form in WordPress
* @url http://www.paulund.co.uk/display-wordpress-search-form
*/
function search_form_shortcode( ) {
get_search_form( );
}
@wpspeak
wpspeak / archive-testimonials.php
Created June 16, 2013 16:02 — forked from cdils/archive-testimonials.php
Create testimonial archive page
<?php
/**
* Template Name: Testimonial Archives
* Description: Used as a page template to show page contents, followed by a loop through a CPT archive
*/
remove_action ('genesis_loop', 'genesis_do_loop'); // Remove the standard loop
add_action( 'genesis_loop', 'custom_do_grid_loop' ); // Add custom loop
// Remove comments from posts
remove_action( 'genesis_after_post', 'genesis_get_comments_template' );
// Add comments back in if conditions are met
add_action( 'genesis_after_post', 'cd_conditional_comments' );
function cd_conditional_comments() {
// Conditional Reference http://codex.wordpress.org/Function_Reference/get_the_author
if ('Author Display Name' == get_the_author() ) {
genesis_get_comments_template();
@wpspeak
wpspeak / functions.php
Created June 16, 2013 22:07 — forked from billerickson/gist:2046751
Three column layout
<?php
/**
* Archive Post Class
* @since 1.0.0
*
* Breaks the posts into three columns
* @link http://www.billerickson.net/code/grid-loop-using-post-class
*
* @param array $classes
@wpspeak
wpspeak / functions.php
Created June 16, 2013 23:11
Move image above post title in Genesis Framework
<?php
// Move image above post title in Genesis Framework
remove_action( 'genesis_post_content', 'genesis_do_post_image' );
add_action( 'genesis_before_post_title', 'genesis_do_post_image' );
<?php
/* Template Name: Test */
/**
* Genesis custom loop
*/
function be_custom_loop() {
global $post;
// arguments, adjust as needed
@wpspeak
wpspeak / functions.php
Created June 17, 2013 03:45
Cuatomize the failed login error message
<?php
// Cuatomize the failed login error message
function failed_login() {
return 'Incorrect login information.';
}
add_filter('login_errors', 'failed_login');