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 | |
/** | |
* Enable Categories for the Location Post Type | |
*/ | |
function enable_categories_in_locations() | |
{ | |
register_taxonomy_for_object_type('category', 'location'); | |
} | |
add_action( 'init', 'enable_categories_in_locations' ); |
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
/** | |
* Set the Location Columns | |
* @param array $columns | |
*/ | |
function locationColumns($columns) | |
{ | |
$columns['wpsl_state'] = 'State'; | |
return $columns; | |
} | |
add_filter('manage_edit-location_columns', 'locationColumns'); |
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
/** | |
* To Enable Category filtering for the location post type | |
* 1) Register categories for the post type | |
* 2) Include "category" in the "taxonomies" shortcode option | |
*/ | |
function add_categories_to_locations() | |
{ | |
register_taxonomy_for_object_type( 'category', 'property' ); | |
} | |
add_action( 'init', 'add_categories_to_locations' ); |
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
add_filter('simple_locator_result', 'location_result', 10, 3); | |
/** | |
* Filter the individual results in the list | |
* @param string $output – HTML to return | |
* @param object $result - SQL result. If custom fields have been added to the query using the JOIN filter, they will be available | |
* @param int $count - current result count | |
*/ | |
function location_result($output, $result, $count) | |
{ | |
$out = '<li>'; |
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
add_filter('the_title', 'filterNestedPagesTitles', 10, 3); | |
function filterNestedPagesTitles($title, $post_id, $view = false) | |
{ | |
if ( !is_admin() ) return $title; | |
$screen = get_current_screen(); | |
if ( $screen->base != 'toplevel_page_nestedpages' ) return $title; | |
if ( !isset($view) || $view != 'nestedpages_title' ) return $title; | |
// Code to configure custom title here | |
$title = 'Custom Title'; | |
return $title; |
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
add_filter('simple_locator_infowindow', 'location_infowindow', 10, 3); | |
/** | |
* Returns the infowindow HTML content | |
* @param string $infowindow – the html content | |
* @param obj $result - the result object | |
* @param int $count - the current result count | |
* @return string $infowindow | |
*/ | |
function location_infowindow($infowindow, $result, $count) |
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 | |
// Place this code in your theme's functions.php file | |
/** | |
* First, add the column to the view | |
* Change the post type by substituting 'post' with the post type | |
* Ex: a post type of recipe would be manage_recipe_posts_columns | |
*/ | |
add_filter('manage_post_posts_columns', 'add_favorite_count_column'); |
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
$(document).on('favorites-updated-single', function(event, favorites, post_id, site_id, status){ | |
if ( status === 'inactive' ) return; | |
window.open("http://yourfavoriteurl.com", '_blank'); | |
}); |
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_filter('nestedpages_edit_link', 'gutenbergEditLink', 10, 2); | |
function gutenbergEditLink($link, $post) | |
{ | |
if ( !is_plugin_active('gutenberg/gutenberg.php') ) return $link; | |
$link = admin_url('admin.php?page=gutenberg&post_id=' . $post->id); | |
return $link; | |
} |
OlderNewer