This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Template Name: You post type | |
*/ | |
?> | |
<?php get_header(); ?> | |
<?php get_template_part('inc/page-title'); ?> | |
<div class="main content" role="main"> | |
<?php | |
// http://codex.wordpress.org/Function_Reference/query_posts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function wpautop_forked($pee, $br = 1) { | |
if ( trim($pee) === '' ) | |
return ''; | |
$pee = $pee . "\n"; // just to make things a little easier, pad the end | |
$pee = preg_replace('|<br />\s*<br />|', "\n\n", $pee); | |
// Space things out a little | |
$allblocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li | |
|pre|select|option|form|map|area|blockquote|img|address|math|style|input |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// event date | |
$dstart = get_field('event_date_start'); | |
$dend = get_field('event_date_end'); | |
if (!$dend) { | |
$dend = $dstart; | |
} | |
$start_year = date("o",strtotime($dstart)); | |
$end_year = date("o",strtotime($dend)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// http://wordpress.stackexchange.com/a/16929/9244 | |
add_action( 'init', 'wpse16902_init' ); | |
function wpse16902_init() { | |
$GLOBALS['wp_rewrite']->use_verbose_page_rules = true; | |
} | |
add_filter( 'page_rewrite_rules', 'wpse16902_collect_page_rewrite_rules' ); | |
function wpse16902_collect_page_rewrite_rules( $page_rewrite_rules ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'init', 'unregister_taxonomy'); | |
function unregister_taxonomy(){ | |
global $wp_taxonomies; | |
$taxonomy = 'post_tag'; | |
if ( taxonomy_exists( $taxonomy)) | |
unset( $wp_taxonomies[$taxonomy]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: FixWpCaption | |
Plugin URI: # | |
Description: Removes inline CSS from .wp-caption | |
*/ | |
class FixWpCaption{ | |
public function __construct(){ | |
add_filter('img_caption_shortcode', array($this, 'fixcaption'), 10, 3); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Remove <img> dimensions | |
// ------------------------------------------------------------- | |
add_filter( 'post_thumbnail_html', 'remove_thumbnail_dimensions', 10 ); | |
add_filter( 'image_send_to_editor', 'remove_thumbnail_dimensions', 10 ); | |
add_filter( 'the_content', 'remove_thumbnail_dimensions', 10 ); | |
function remove_thumbnail_dimensions( $html ) { | |
$html = preg_replace( '/(width|height)=\"\d*\"\s/', "", $html ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function my_query_excerpt($page) { | |
global $post; | |
$save_post = $post; | |
$post = get_post($page); | |
$output = '<p>' . get_the_excerpt() . '</p>'; | |
$post = $save_post; | |
return $output; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Simple Slideshow | |
$(function () { | |
var visibleClass = 'visible'; // no . | |
var currentClass = 'current'; // no . | |
var animationTime = 300; // fade duration | |
var containerClass = '.slides'; // class on container | |
var slideItem = 'img'; // what are we sliding? | |
var slideItems = $(containerClass).find(slideItem); // all slides | |
var slideNumbers = $(".slide-nav a"); // pagination numbers | |
var slideNext = $(".next"); // next link |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// Remove columns from Tags section and add Tag ID | |
// ------------------------------------------------------------- | |
add_filter('manage_edit-post_tag_columns', 'my_post_tag_columns', 5); | |
function my_post_tag_columns($defaults) { | |
$defaults['tag_id'] = 'Tag ID'; | |
unset($defaults['description']); | |
unset($defaults['slug']); | |
return $defaults; |