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('nestedpages_page_listing', 'nestedpagesQueryFilter'); | |
function nestedpagesQueryFilter($args) | |
{ | |
$args['post_status'][] = 'custom_post_status'; | |
return $args; | |
} |
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 | |
/** | |
* For a list of all actions, see wp-nested-pages/app/Entities/PostType/PostTypeRepository, line 97 | |
*/ | |
// Hide/Show the "WPML" link if installed | |
add_filter('nestedpages_row_action_wpml', 'nestedPagesWpmlLink', 10, 2); | |
function nestedPagesWpmlLink($include, $post_type) | |
{ | |
return true; |
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
/** | |
* Place in your theme's functions.php | |
*/ | |
add_action('admin_head', 'hide_nested_pages_add_multiple'); | |
function hide_nested_pages_add_multiple() | |
{ | |
$user = wp_get_current_user(); | |
$allowed_roles = ['administrator']; | |
if ( array_intersect($allowed_roles, $user->roles) ) return; | |
echo '<style>.open-bulk-modal, .nestedpages .action-buttons .nestedpages-dropdown ul li a.add-new-child, .nestedpages .action-buttons .nestedpages-dropdown ul li:nth-child(2) {display:none;}</style>'; |
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; | |
} |
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
/** | |
* favorites-updated-single | |
* Fires after a favorite button has been submitted successfully | |
* @param favorites - Array of post objects the user has favorited | |
* @param post_id - The post ID that was updated | |
* @param site_id - The site ID for the post that was updated (for multisite) | |
* @param status - Whether the button was active or inactive | |
*/ | |
$(document).on('favorites-updated-single', function(event, favorites, post_id, site_id, status){ | |
// Do stuff here as needed. |
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 | |
/** | |
* Using this method, a GET parameter can be passed to the page, enabling a simple locator form to be populated and submitted dynamically. | |
* One use case may exist where the user submits a gravity form, and is redirected to a list of locations without needing to resubmit the simple locator form. | |
* This code would be placed in a page template. | |
*/ | |
// First, we check if a GET parameter named "search" exists. If so, we sanitize it and set it for our use | |
// This could be passed via a link, or through another form submission | |
$location_search = ( isset($_GET['search']) ) ? sanitize_text_field($_GET['search']) : false; |
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
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; |