Skip to content

Instantly share code, notes, and snippets.

View wpspeak's full-sized avatar

WPSpeak wpspeak

View GitHub Profile
@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 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 / 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
<?php
/* Template Name: Test */
/**
* Genesis custom loop
*/
function be_custom_loop() {
global $post;
// arguments, adjust as needed
@wpspeak
wpspeak / annotated-style.css
Created June 19, 2013 07:24 — forked from GaryJones/annotated-style.css
Fix Genesis 2.0 CSS for Gist (Props Gary)
/* Same as other file, but with extra notes */
/* Embedded Gists */
.line-pre::before,
.line-pre::after,
.line::before,
.line::after {
content: ''; /* Fixes addition of float-clearing space added to before and after global pre and div elements */
}
@wpspeak
wpspeak / functions.php
Last active April 16, 2019 14:19 — forked from braddalton/Add Genesis Search Box To Primary Nav Menu.php
Add Genesis Search Box to Secondary Menu
<?php
// Add Genesis search form to secondary menu
add_filter( 'wp_nav_menu_items', 'genesis_search_secondary_nav_menu', 10, 2 );
function genesis_search_secondary_nav_menu( $menu, stdClass $args ){
if ( 'secondary' != $args->theme_location )
<?php
add_action( 'wp_enqueue_scripts', 'prefix_enqueue_awesome' );
/**
* Register and load font awesome
* CSS files using a CDN.
*
* @link http://www.bootstrapcdn.com/#tab_fontawesome
* @author FAT Media
*/
function prefix_enqueue_awesome() {
@wpspeak
wpspeak / functions.php
Last active December 21, 2015 16:59 — forked from christophercochran/Genesis Layout Logic
Conditionally force layout in Genesis Framework
<?php
/**
* Conditionally force layout in Genesis Framework
*/
function cc_layout_logic() {
/**
* Genesis layout helper functions.
* __genesis_return_content_sidebar
* __genesis_return_sidebar_content