email working - remove clients - preview polish
This commit is contained in:
1 parent
2b1424d127
commit
da83beaec3
19 files changed
+1342
-1060
No files matched your search
@@ -3,7 +3,7 @@
|
||||
* Plugin Name: Hi-School Slide Manager
|
||||
* Plugin URI: https://hi-school.com/slide-manager
|
||||
* Description: Multi-site slide management system for Hi-School websites. Allows staff to create and schedule slides on the main site, display them as headers on companion sites via REST API, with advanced preview and editing capabilities.
|
||||
* Version: 1.1.2
|
||||
* Version: 1.1.9
|
||||
* Author: Hi-School Development Team
|
||||
* Author URI: https://hi-school.com
|
||||
* License: GPL v2 or later
|
||||
@@ -22,7 +22,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
}
|
||||
|
||||
// Plugin constants
|
||||
define( 'HSSM_VERSION', '1.1.2' );
|
||||
define( 'HSSM_VERSION', '1.1.9' );
|
||||
define( 'HSSM_PLUGIN_FILE', __FILE__ );
|
||||
define( 'HSSM_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
||||
define( 'HSSM_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
||||
@@ -50,6 +50,79 @@ function hssm_debug_log( $message ) {
|
||||
error_log( 'HSSM: ' . $message );
|
||||
}
|
||||
|
||||
/**
|
||||
* Permalink for a published page using a plugin template.
|
||||
*
|
||||
* Prefers a matching slug, then any page with the template, including children.
|
||||
* get_pages() with hierarchical=1 can skip child pages, so this uses WP_Query.
|
||||
*
|
||||
* @since 1.1.3
|
||||
* @param string $template Page template filename.
|
||||
* @param string $fallback_path Optional path used when no page is found.
|
||||
* @return string
|
||||
*/
|
||||
function hssm_get_page_url_by_template( $template, $fallback_path = '' ) {
|
||||
$preferred_slug = '';
|
||||
if ( 'page-slide-preview.php' === $template ) {
|
||||
$preferred_slug = 'slide-preview';
|
||||
} elseif ( 'page-slide-dashboard.php' === $template ) {
|
||||
$preferred_slug = 'slide-dashboard';
|
||||
} elseif ( 'page-slide-confirmation.php' === $template ) {
|
||||
$preferred_slug = 'slide-confirmation';
|
||||
}
|
||||
|
||||
$query = new WP_Query(
|
||||
array(
|
||||
'post_type' => 'page',
|
||||
'post_status' => array( 'publish', 'private' ),
|
||||
'posts_per_page' => 20,
|
||||
'no_found_rows' => true,
|
||||
'meta_key' => '_wp_page_template',
|
||||
'meta_value' => $template,
|
||||
'orderby' => array(
|
||||
'menu_order' => 'ASC',
|
||||
'ID' => 'ASC',
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
$match = null;
|
||||
if ( $query->have_posts() ) {
|
||||
foreach ( $query->posts as $page ) {
|
||||
if ( $preferred_slug && $preferred_slug === $page->post_name ) {
|
||||
$match = $page;
|
||||
break;
|
||||
}
|
||||
if ( ! $match ) {
|
||||
$match = $page;
|
||||
}
|
||||
}
|
||||
}
|
||||
wp_reset_postdata();
|
||||
|
||||
if ( $match ) {
|
||||
return get_permalink( $match->ID );
|
||||
}
|
||||
|
||||
$path_candidates = array();
|
||||
if ( $preferred_slug ) {
|
||||
$path_candidates[] = 'slide-dashboard/' . $preferred_slug;
|
||||
$path_candidates[] = $preferred_slug;
|
||||
}
|
||||
if ( $fallback_path ) {
|
||||
$path_candidates[] = trim( $fallback_path, '/' );
|
||||
}
|
||||
|
||||
foreach ( array_unique( $path_candidates ) as $path ) {
|
||||
$page = get_page_by_path( $path );
|
||||
if ( $page ) {
|
||||
return get_permalink( $page->ID );
|
||||
}
|
||||
}
|
||||
|
||||
return $fallback_path ? home_url( $fallback_path ) : '';
|
||||
}
|
||||
|
||||
// Include core files
|
||||
require_once HSSM_PLUGIN_DIR . 'includes/class-hssm-autoloader.php';
|
||||
require_once HSSM_PLUGIN_DIR . 'includes/class-hssm-main.php';
|
||||
|
||||
Reference in new issue
Block a user