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 | |
// 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 | |
// 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 | |
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 | |
/* | |
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
<? | |
// include template using WP shortcode | |
function my_shortcode_include() { | |
ob_start(); | |
// include your template e.g. /inc/random-panel.php | |
get_template_part('inc/random-panel'); | |
$output_string = ob_get_contents(); | |
ob_end_clean(); | |
return $output_string; |
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
<? | |
// EVENTS | |
add_action('init', '_init_event_post_type'); | |
function _init_event_post_type() { | |
// Create taxonomy | |
register_taxonomy( | |
'event_category', |
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 | |
// Return link by post ID | |
// ------------------------------------------------------------- | |
function link_by_id($post_id) { | |
echo '<a href="'.get_permalink($post_id).'">'.get_the_title($post_id).'</a>'; | |
} | |
// Return the root parent ID | |
// ------------------------------------------------------------- |
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
/*----------------------------------------------------------------------------------------*/ | |
/* Opt-in typography - http://goo.gl/H6sGd | |
* Zero off common semantic elements to stop re-definition | |
* Use .text class on the parent of anything requiring text styles | |
/*----------------------------------------------------------------------------------------*/ | |
$baseline: 1.5em; | |
@mixin zero-text-elements { | |
h1, h2, h3, h4, h5, h6, blockquote, pre, |
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
<? | |
// no idea why this works but add to wp-config.php | |
define('SCRIPT_DEBUG', true); |