This file contains hidden or 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
//hook into the init action and call create_book_taxonomies when it fires | |
add_action( 'init', 'create_topics_hierarchical_taxonomy', 0 ); | |
//create a custom taxonomy name it topics for your posts | |
function create_topics_hierarchical_taxonomy() { | |
// Add new taxonomy, make it hierarchical like categories | |
//first do the translations part for GUI |
This file contains hidden or 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 | |
$course_terms = get_terms( array( | |
'taxonomy' => 'course_category', | |
'hide_empty' => false, | |
) ); | |
//fprint_r($course_terms); | |
foreach($course_terms as $course_term){ | |
$course_category_id = $course_term->term_id; |
This file contains hidden or 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 my_posts_where( $where ) { | |
$where = str_replace("meta_key = 'document_%", "meta_key LIKE 'document_%", $where); | |
return $where; | |
} | |
add_filter('posts_where', 'my_posts_where'); | |
This file contains hidden or 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
add_action( 'template_redirect', function() { | |
if ( is_singular( 'authors' ) ) { | |
global $wp_query; | |
$page = ( int ) $wp_query->get( 'page' ); | |
if ( $page > 1 ) { | |
// convert 'page' to 'paged' | |
$query->set( 'page', 1 ); | |
$query->set( 'paged', $page ); | |
} | |
// prevent redirect |
This file contains hidden or 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
$query = $_SERVER['QUERY_STRING']; | |
$query_arr = explode("&", $query); | |
$count_arr = count($query_arr); | |
for($j = 0; $j < $count_arr; $j++){ | |
if(strpos($query_arr[$j], "pagen") !== false){ | |
//echo $j . "<br />"; |
This file contains hidden or 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 | |
define('OAUTH2_CLIENT_ID', ''); | |
define('OAUTH2_CLIENT_SECRET', ''); | |
$authorizeURL = 'https://github.com/login/oauth/authorize'; | |
$tokenURL = 'https://github.com/login/oauth/access_token'; | |
$apiURLBase = 'https://api.github.com/'; | |
session_start(); |
This file contains hidden or 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
add_action( 'show_user_profile', 'my_show_extra_profile_fields' ); | |
add_action( 'edit_user_profile', 'my_show_extra_profile_fields' ); | |
function my_show_extra_profile_fields( $user ) { ?> | |
<h3>Extra profile information</h3> | |
<table class="form-table"> | |
<tr> | |
<th><label for="phone">Phone Number</label></th> | |
<td> | |
<input type="text" name="phone" id="phone" value="<?php echo esc_attr( get_the_author_meta( 'phone', $user->ID ) ); ?>" class="regular-text" /><br /> | |
<span class="description">Please enter your phone number.</span> |
This file contains hidden or 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 add_acf_columns ( $columns ) { | |
return array_merge ( $columns, array ( | |
'location' => __ ( 'Location' ), | |
'price' => __ ( 'Price' ) | |
) ); | |
} | |
add_filter ( 'manage_course_posts_columns', 'add_acf_columns' ); | |
function course_custom_column ( $column, $post_id ) { | |
switch ( $column ) { |
This file contains hidden or 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 set_same_height(selector){ | |
var max_height = 0; | |
$(selector).each(function(){ | |
if($(this).height() > max_height){ | |
max_height = $(this).height(); | |
} | |
}); | |
$(selector).each(function(){ | |
$(this).height(max_height); |