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 date ranges from post titles | |
* | |
* @author ericpedia | |
* @since 2014-08-26 | |
* | |
*/ |
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
(function($) { | |
$.fn.changeElementType = function(newType) { | |
return this.each(function() { | |
var attrs = {}; | |
$.each(this.attributes, function(idx, attr) { | |
attrs[attr.nodeName] = attr.nodeValue; | |
}); | |
$(this).replaceWith(function() { |
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
if (!class_exists('SubHeading')) { | |
class SubHeading | |
{ | |
var $name = 'SubHeading'; | |
var $tag = 'subheading'; | |
var $meta_key; | |
var $options = array(); | |
function SubHeading() | |
{ | |
if ($options = get_option($this->tag)) { |
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
// http://wordpress.stackexchange.com/questions/23088/how-to-change-a-custom-query-into-a-standard-loop | |
$totalposts = $wpdb->get_results($querystr, OBJECT); | |
$wp_query->request = $querystr . " LIMIT " . $ppp . " OFFSET " .$offset; | |
$results = $wpdb->get_results($wp_query->request, OBJECT); | |
foreach ($results as $result) { /* instead of this I want something that would work like while ( $the_query->have_posts() ) : $the_query->the_post(); */ | |
$offset++; | |
$output .= '<a href="'.get_post_permalink($result->ID).'">' . $result->post_title . ' (' . $result->post_date . ')</a><br>'; |
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
function hey_author_link() { | |
$terms = wp_get_object_terms( get_the_ID(), 'people' ); | |
$term_permalink = get_term_link($terms[0]->slug, 'people'); | |
return $term_permalink; | |
} |
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 get_term_top_most_parent($term_id, $taxonomy){ | |
$parent = get_term_by( 'id', $term_id, $taxonomy); | |
while ($parent->parent != 0){ | |
$parent = get_term_by( 'id', $term_id, $taxonomy); | |
} | |
return $parent; | |
} | |
// so once you have this function you can just loop over the results returned by wp_get_object_terms |
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 | |
/**************************************************** | |
Get top-most parent of a taxonomy term | |
****************************************************/ | |
function get_term_top_most_parent($term_id, $taxonomy){ | |
$term = get_term_by( 'id', $term_id, $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 | |
//remove default metabox | |
//change TAXONOMY_NAME to your taxonomy name | |
add_action( 'admin_menu' , 'remove_post_custom_fields' ); | |
function remove_post_custom_fields() { | |
remove_meta_box( 'categorydiv' , 'post' , 'normal' ); | |
} | |
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 default metabox | |
//change TAXONOMY_NAME to your taxonomy name | |
function remove_post_custom_fields() { | |
remove_meta_box( 'issuediv' , 'post' , 'normal' ); | |
} | |
//add our custom meta box |
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 default metabox | |
//change TAXONOMY_NAME to your taxonomy name | |
// My taxonomy slug is 'issue' | |
function remove_post_custom_fields() { | |
remove_meta_box( 'issuediv' , 'post' , 'normal' ); | |
} |
OlderNewer