Update super-simple-slideshow.php

name change
This commit is contained in:
ai-bot committed 2026-10-13 08:49:12 +00:00
1 parent ed3def6e48
commit d47bf0885d
1 file changed
+17 -17
+17 -17
View File
@@ -3,34 +3,34 @@
Plugin Name: Super Simple Slideshow Plugin Name: Super Simple Slideshow
Description: Super simple slideshow plugin for Wordpress. Description: Super simple slideshow plugin for Wordpress.
Version: 1.0 Version: 1.0
Author: Sondre Olav Author: ai-bot
*/ */
if (!defined('ABSPATH')) exit; if (!defined('ABSPATH')) exit;
add_action('admin_menu', function(){ add_action('admin_menu', function(){
add_menu_page('NTKF Slideshow','NTKF Slideshow','manage_options','ntkf-slideshow','ntkf_slideshow_admin'); add_menu_page('Super Simple Slideshow','Super Simple Slideshow','manage_options','super-simple-slideshow','super_simple_slideshow_admin');
}); });
add_action('admin_enqueue_scripts', function($hook){ add_action('admin_enqueue_scripts', function($hook){
if($hook !== 'toplevel_page_ntkf-slideshow') return; if($hook !== 'toplevel_page_super-simple-slideshow') return;
wp_enqueue_media(); wp_enqueue_media();
wp_enqueue_script('jquery'); wp_enqueue_script('jquery');
}); });
function ntkf_slideshow_admin(){ function super_simple_slideshow_admin(){
if(isset($_POST['ntkf_ids'])){ if(isset($_POST['super_simple_ids'])){
update_option('ntkf_slideshow_ids', sanitize_text_field($_POST['ntkf_ids'])); update_option('super_simple_slideshow_ids', sanitize_text_field($_POST['super_simple_ids']));
echo '<div class="notice notice-success"><p>Lagra.</p></div>'; echo '<div class="notice notice-success"><p>Lagra.</p></div>';
} }
$ids = get_option('ntkf_slideshow_ids',''); $ids = get_option('super_simple_slideshow_ids','');
?> ?>
<div class="wrap"> <div class="wrap">
<h1>NTKF Slideshow</h1> <h1>Super Simple Slideshow</h1>
<form method="post"> <form method="post">
<input type="hidden" id="ntkf_ids" name="ntkf_ids" value="<?php echo esc_attr($ids); ?>"> <input type="hidden" id="super_simple_ids" name="super_simple_ids" value="<?php echo esc_attr($ids); ?>">
<p><button type="button" class="button button-primary" id="ntkf_select">Vel bilete</button></p> <p><button type="button" class="button button-primary" id="super_simple_select">Vel bilete</button></p>
<div id="preview"> <div id="preview">
<?php <?php
@@ -50,7 +50,7 @@ function ntkf_slideshow_admin(){
<script> <script>
jQuery(function($){ jQuery(function($){
$('#ntkf_select').on('click', function(e){ $('#super_simple_select').on('click', function(e){
e.preventDefault(); e.preventDefault();
var frame = wp.media({ var frame = wp.media({
@@ -72,7 +72,7 @@ jQuery(function($){
} }
}); });
$('#ntkf_ids').val(ids.join(',')); $('#super_simple_ids').val(ids.join(','));
$('#preview').html(html); $('#preview').html(html);
}); });
@@ -83,9 +83,9 @@ jQuery(function($){
<?php <?php
} }
add_shortcode('ntkf_slideshow', function(){ add_shortcode('super_simple_slideshow', function(){
$ids = get_option('ntkf_slideshow_ids',''); $ids = get_option('super_simple_slideshow_ids','');
if(empty($ids)) return ''; if(empty($ids)) return '';
$ids = explode(',', $ids); $ids = explode(',', $ids);
@@ -93,17 +93,17 @@ add_shortcode('ntkf_slideshow', function(){
ob_start(); ob_start();
?> ?>
<div class="ntkf-slideshow"> <div class="super-simple-slideshow">
<?php foreach($ids as $i => $id): ?> <?php foreach($ids as $i => $id): ?>
<?php echo wp_get_attachment_image((int)$id,'full',false,array( <?php echo wp_get_attachment_image((int)$id,'full',false,array(
'class' => $i === 0 ? 'ntkf-slide active' : 'ntkf-slide' 'class' => $i === 0 ? 'super-simple-slide active' : 'super-simple-slide'
)); ?> )); ?>
<?php endforeach; ?> <?php endforeach; ?>
</div> </div>
<script> <script>
document.addEventListener('DOMContentLoaded', function(){ document.addEventListener('DOMContentLoaded', function(){
const slides=document.querySelectorAll('.ntkf-slideshow .ntkf-slide'); const slides=document.querySelectorAll('.super-simple-slideshow .super-simple-slide');
if(slides.length < 2) return; if(slides.length < 2) return;