Skip to content

Instantly share code, notes, and snippets.

View WebEndevSnippets's full-sized avatar

Bruce Munson WebEndevSnippets

View GitHub Profile
@WebEndevSnippets
WebEndevSnippets / functions.php
Created January 3, 2013 18:06
WordPress: Fixes Issue with CMB on Windows Local
/** Fixes Issue with CMB on Windows Local */
add_filter( 'cmb_meta_box_url', 'we_windows_cmb_meta_box_url' );
function we_windows_cmb_meta_box_url( $url ){
return trailingslashit( str_replace( '\\', '/', str_replace( str_replace( '/', '\\', WP_CONTENT_DIR ), WP_CONTENT_URL, $url ) ) );
}
@WebEndevSnippets
WebEndevSnippets / taxonomies.php
Created January 8, 2013 19:57
WordPress: Add Taxonomy Filter to CPT Admin
add_action( 'restrict_manage_posts', 'we_add_submissions_taxonomy_filters' );
/**
* Add taxonomy filter to the Submissions CPT admin page
*
*/
function we_add_submissions_taxonomy_filters() {
global $typenow;
// an array of all the taxonomies you want to display. Use the taxonomy name or slug
$taxonomies = array('we_type');
@WebEndevSnippets
WebEndevSnippets / post-types.php
Created January 8, 2013 22:19
WordPress: Change 'Enter Title Here' On A CPT
add_filter( 'enter_title_here', 'we_change_submissions_cpt_title' );
/**
* Change 'Enter Title Here' text for Submissions CPT
*
*/
function we_change_submissions_cpt_title( $title ){
$screen = get_current_screen();
if ( 'we_submission' == $screen->post_type ) {
$title = 'Enter Site Name';
@WebEndevSnippets
WebEndevSnippets / functions.php
Created January 10, 2013 20:05
WordPress: Automatically Create Page on Theme Activation
$page = get_page_by_title( 'Submissions Test' );
if ( null == $page ) {
$args = array(
'post_type' => 'page',
'post_title' => 'Submissions Test',
'post_status' => 'private',
'post_content' => 'This page was automatically created for your theme. This page displays your Submissions entries and SHOULD NOT BE REMOVED.',
'comment_status' => 'closed',
'ping_status' => 'closed',
@WebEndevSnippets
WebEndevSnippets / functions.php
Created January 11, 2013 16:01
WordPress: Set Sorting for Admin Column on a CPT
add_filter( 'request', 'we_complete_column_orderby' );
/**
* Sorting for the 'Complete' column in Submissions (we_submission) CPT, browse admin page
*
*/
function we_complete_column_orderby( $vars ) {
if ( isset( $vars['orderby'] ) && 'we_item-complete' == $vars['orderby'] ) {
$vars = array_merge( $vars, array(
'meta_key' => 'we_item-complete',
'orderby' => 'meta_value'
remove_action( 'genesis_header', 'genesis_do_header' );
add_action( 'genesis_header', 'shireman_do_custom_header' );
/**
* Modify the default header, including the #title-area div,
* along with #title and #description.
*
* Calls the genesis_site_title, and genesis_site_description.
*
* Adds book thumbnail display.
*
@WebEndevSnippets
WebEndevSnippets / page_novels.php
Created January 15, 2013 16:42
Genesis: Page template Novels
<?php
/*
Template Name: Novels
*/
/** Remove Post Meta and Post Info */
remove_action( 'genesis_before_post_content', 'genesis_post_info' );
remove_action( 'genesis_after_post_content', 'genesis_post_meta' );
/** Add Novels body class */
@WebEndevSnippets
WebEndevSnippets / functions.php
Created January 19, 2013 14:03
WordPress: Filter the_content on Blog Template
add_action( 'get_header', 'shireman_template_check' );
/**
* Filter the_content on Blog Page Template
*
*/
function shireman_template_check() {
if ( is_page_template( 'page_blog.php' ) )
add_filter( 'the_content', 'shireman_filter_blog_content' );
}
@WebEndevSnippets
WebEndevSnippets / functions.php
Created January 19, 2013 14:07
Genesis: Add Post Edit Link on Published Books CPT Single
add_action( 'genesis_after_post_content', 'we_add_books_edit_link', 5 );
/**
* Add Post Edit Link on Published Books CPT Single
*
*/
function we_add_books_edit_link() {
if ( 'we_published-book' == get_post_type() && is_single() ) {
echo '<div class="clear">';
edit_post_link( 'Edit', '', '' );
echo '</div>';
@WebEndevSnippets
WebEndevSnippets / functions.php
Created January 19, 2013 14:13
Genesis: Customize Footer Credits
add_filter( 'genesis_footer_creds_text', 'shireman_footer_creds_text' );
/**
* Customize the footer credits
*
*/
function shireman_footer_creds_text() {
echo '<div class="creds"><p>';
echo 'Copyright &copy; ';
echo date( 'Y' );
echo ' &middot; <a href="'.home_url().'">'.get_bloginfo('name').'</a> &middot; Site Design by <a href="http://www.webendev.com/" title="WebEndev LLC">WebEndev</a>';