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 | |
/* 1. Back End Usage | |
---------------------------------------------------------------------*/ | |
// add neccessary actions | |
// @see http://codex.wordpress.org/Function_Reference/add_action | |
add_action( 'add_meta_boxes', 'rg_add_custom_box' ); | |
add_action( 'save_post', 'rg_save_postdata', 10, 1 ); |
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 | |
/** | |
* WordPress Query Comprehensive Reference | |
* Compiled by luetkemj - luetkemj.com | |
* | |
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query | |
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php | |
*/ | |
$args = array( |
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 mostra(){ | |
//http://stackoverflow.com/a/15505132 - reference | |
global $post; | |
$taxonomies = get_object_taxonomies($post->post_type); | |
foreach ($taxonomies as $taxonomy) { | |
$terms = get_the_terms( $post->ID, $taxonomy ); | |
if ( !empty( $terms ) ) { | |
foreach ( $terms as $term ){ |
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
<!doctype html> | |
<html> | |
<body> | |
<div id="ytplayer"></div> | |
<script> | |
// Load the IFrame Player API code asynchronously. | |
var tag = document.createElement('script'); | |
tag.src = "https://www.youtube.com/player_api"; |
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 favicon to site, add 16x16 or 32x32 "favicon.ico" image to child themes main folder | |
function childtheme_add_favicon() { ?> | |
<link rel="shortcut icon" href="<?php echo get_stylesheet_directory_uri(); ?>/favicon.ico" /> | |
<?php } | |
add_action('wp_head', 'childtheme_add_favicon'); | |
?> |
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 | |
/*paste this in functions.php*/ | |
function the_slug() { | |
global $post; | |
$slug = $post->post_name; | |
return $slug; | |
} | |
/* --- */ | |
/*call your slug in your page*/ |
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 | |
#limit chars | |
function excerpt($limit) { | |
$excerpt = explode(' ', get_the_excerpt(), $limit); | |
if (count($excerpt)>=$limit) { | |
array_pop($excerpt); | |
$excerpt = implode(" ",$excerpt).'...'; | |
} else { | |
$excerpt = implode(" ",$excerpt); | |
} |
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', 'my_custom_init'); | |
function my_custom_init() { | |
add_post_type_support( 'page', 'excerpt' ); | |
} | |
?> |
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 comments*/ | |
//http://themeshaper.com/forums/topic/removing-comments-section-from-thematic | |
function remove_comments(){ | |
if (is_page()){ | |
remove_action('thematic_comments_template','thematic_include_comments',5); | |
} | |
} | |
add_action('template_redirect','remove_comments'); |