Add title generator
This commit is contained in:
@@ -40,7 +40,7 @@ function sp_event_team_meta( $post ) {
|
||||
for ( $i = 0; $i < $limit; $i++ ):
|
||||
?>
|
||||
<div>
|
||||
<p class="sp-tab-select">
|
||||
<p class="sp-tab-select sp-title-generator">
|
||||
<?php
|
||||
$args = array(
|
||||
'post_type' => 'sp_team',
|
||||
|
||||
@@ -14,6 +14,7 @@ $sportspress_texts = array(
|
||||
'Remove featured image' => sprintf( __( 'Remove %s', 'sportspress' ), __( 'Logo', 'sportspress' ) )
|
||||
),
|
||||
'sp_event' => array(
|
||||
'Enter title here' => '',
|
||||
'Scheduled for: <b>%1$s</b>' => __( 'Kick-off', 'sportspress' ) . ': <b>%1$s</b>',
|
||||
'Published on: <b>%1$s</b>' => __( 'Kick-off', 'sportspress' ) . ': <b>%1$s</b>',
|
||||
'Publish <b>immediately</b>' => __( 'Kick-off', 'sportspress' ) . ': <b>%1$s</b>'
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
function sp_admin_enqueue_scripts() {
|
||||
wp_enqueue_script( 'sportspress-admin', plugin_dir_url( __FILE__ ) .'/sportspress-admin.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-datepicker' ), time(), true );
|
||||
wp_enqueue_script( 'jquery' );
|
||||
wp_enqueue_script( 'sportspress-admin', plugin_dir_url( __FILE__ ) .'/sportspress-admin.js', array( 'jquery' ), time(), true );
|
||||
}
|
||||
add_action( 'admin_enqueue_scripts', 'sp_admin_enqueue_scripts' );
|
||||
?>
|
||||
10
settings.php
10
settings.php
@@ -12,7 +12,15 @@ function sp_settings_menu() {
|
||||
add_action('admin_menu', 'sp_settings_menu');
|
||||
|
||||
function sp_settings_page() {
|
||||
echo '<input type="text" id="datepicker" name="example[datepicker]" value="" class="sp_datepicker" />';
|
||||
?>
|
||||
<div class="wrap">
|
||||
<h2 class="nav-tab-wrapper">
|
||||
<?php _e( 'SportsPress Settings', 'sportspress' ); ?>
|
||||
<a href="#" class="nav-tab nav-tab-active">Tab 1</a>
|
||||
<a href="#" class="nav-tab">Tab 2</a>
|
||||
</h2>
|
||||
</div>
|
||||
<?php
|
||||
/*
|
||||
if ( true | ! current_user_can( 'manage_options' ) ) wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
|
||||
$hidden_field_name = 'tb_submit_hidden';
|
||||
|
||||
@@ -1,20 +1,30 @@
|
||||
jQuery(document).ready(function($){
|
||||
|
||||
// Switch tabs
|
||||
$('.sp-tab-panel').siblings('.sp-tab-bar').find('a').click(function() {
|
||||
$(this).closest('li').removeClass('wp-tab').addClass('wp-tab-active').siblings().removeClass('wp-tab-active').addClass('wp-tab').closest('.wp-tab-bar').siblings($(this).attr('href')).show().siblings('.wp-tab-panel').hide();
|
||||
return false;
|
||||
});
|
||||
|
||||
// Filter tabs
|
||||
$('.sp-tab-panel').siblings('.sp-tab-select').find('select').change(function() {
|
||||
$val = $(this).val();
|
||||
var val = $(this).val();
|
||||
$(this).closest('.sp-tab-select').siblings('.sp-tab-panel').find('.sp-post').hide(0, function() {
|
||||
$(this).find('input').prop('disabled', true);
|
||||
$(this).filter('.sp-filter-'+$val).show(0, function() {
|
||||
$(this).filter('.sp-filter-'+val).show(0, function() {
|
||||
$(this).find('input').prop('disabled', false);
|
||||
});
|
||||
});
|
||||
return;
|
||||
});
|
||||
|
||||
// Activate tab filters
|
||||
$('.sp-tab-panel').siblings('.sp-tab-select').find('select').change();
|
||||
|
||||
// Change title
|
||||
$('.sp-title-generator select').change(function() {
|
||||
title = $('.sp-title-generator select[value!=0]').map(function(){
|
||||
return $(this).find(':selected').html().replace(/&[^;]+;/g, '');
|
||||
}).get().join(' vs ');
|
||||
$('input[name=post_title]').val(title);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user