diff --git a/Gulpfile.js b/Gulpfile.js
index e4da418..3b8202b 100644
--- a/Gulpfile.js
+++ b/Gulpfile.js
@@ -46,7 +46,7 @@ gulp.task('test-cs', function (cb) {
// Bundle files as required for plugin distribution..
gulp.task('bundle', ['clean'], function () {
console.log('Collecting files for package dist/' + config.name + config.version + ' ...');
- return gulp.src(['**/*.php', '!test/**', '!vendor/**', 'README.md', 'LICENSE.md'], {base: './'})
+ return gulp.src(['**/*.php', 'styles/*.css', '!test/**', '!vendor/**', 'README.md', 'LICENSE.md'], {base: './'})
.pipe(copy('./dist/' + config.name + '.' + config.version + '/' + config.name));
});
diff --git a/includes/admin/media-button.php b/includes/admin/media-button.php
deleted file mode 100644
index 0c96399..0000000
--- a/includes/admin/media-button.php
+++ /dev/null
@@ -1,99 +0,0 @@
-Add Download';
- }
-}
-add_filter( 'media_buttons_context', 'wplt_media_button' );
-
-/**
- * Add Modal Window to Footer
- *
- * @return void
- */
-function wplt_media_modal() {
- global $wplt_options;
-
- $downloads = new WP_Query( 'post_type=wplt_download&nopaging=true&orderby=title&order=ASC' );
- ?>
-
- ID, '_wplt_file_url', true );
- $file_size = get_post_meta( $post->ID, '_wplt_file_size', true );
-
- global $post;
-
- $plupload_init = array(
- 'runtimes' => 'html5, silverlight, flash, html4',
- 'browse_button' => 'plupload-browse-button',
- 'container' => 'plupload-container',
- 'file_data_name' => 'async-upload',
- 'multiple_queues' => false,
- 'max_file_size' => wp_max_upload_size() . 'b',
- 'url' => admin_url( 'admin-ajax.php' ),
- 'flash_swf_url' => includes_url( 'js/plupload/plupload.flash.swf' ),
- 'silverlight_xap_url' => includes_url( 'js/plupload/plupload.silverlight.xap' ),
- 'filters' => array( array( 'title' => __( 'Allowed Files' ), 'extensions' => '*' ) ),
- 'multipart' => true,
- 'urlstream_upload' => true,
-
- // additional post data to send to our ajax hook
- 'multipart_params' => array(
- '_ajax_nonce' => wp_create_nonce( 'wplt_download_upload' ),
- 'action' => 'wplt_download_upload',
- 'post_id' => $post->ID
- ),
- );
-
- // Pass to plupload
- $plupload_init = apply_filters( 'plupload_init', $plupload_init );
-
- ?>
-
-
-
-
-
-
- 0 ) {
- // Set upload dir
- add_filter( 'upload_dir', 'wplt_set_upload_dir' );
-
- // Upload the file
- $file = wp_handle_upload( $_FILES['async-upload'], array( 'test_form' => false ) );
-
- // Check for success
- if( isset( $file['file'] ) ) {
- // Post ID
- $post_id = $_REQUEST['post_id'];
-
- // Add/update post meta
- update_post_meta( $post_id, '_wplt_file_url', $file['url'] );
- update_post_meta( $post_id, '_wplt_file_size', $_FILES['async-upload']['size'] );
- update_post_meta( $post_id, '_wplt_file_type', $file['type'] );
- }
- }
-}
-add_action( 'save_post', 'wplt_meta_box_file_save' );
-
-/**
- * Render stats meta box
- *
- * @param object $post current post object
- *
- * @return void
- */
-function wplt_meta_box_stats( $post ) {
- $file_count = get_post_meta( $post->ID, '_wplt_file_count', true );
- ?>
-
-
- '',
- 'title' => __( 'Title', 'wplt2' ),
- 'author' => __( 'Author', 'wplt2' ),
- 'wplt_ticker' => __( 'Ticker', 'wplt2'),
- 'date' => __( 'Date', 'wplt2' )
- );
-}
-//add_filter( 'manage_wplt_tick_posts_columns', 'wplt_tick_column_headings' );
-
-/**
- * Download post type column contents
- *
- * @param array $column_name current column
- * @param int $post_id current post id provided by WordPress
- *
- * @return void
- */
-function wplt_tick_column_contents( $column_name, $post_id ) {
- // Title column
- if( $column_name == 'file' ) {
- $path = get_post_meta( $post_id, '_wplt_file_url', true );
- echo wplt_download_filename( $path );
- }
-}
-add_action( 'manage_wplt_tick_posts_custom_column', 'wplt_tick_column_contents', 10, 2 );
-
-/**
- * Download post type sortable columns filter
- *
- * @param array $columns as set above
- *
- * @return void
- */
-function wplt_tick_column_sortable( $columns ) {
- $columns['ticks'] = 'ticks';
-
- return $columns;
-}
-add_filter( 'manage_edit-wplt_tick_sortable_columns', 'wplt_tick_column_sortable' );
-
-/**
- * Download post type sortable columns action
- *
- * @param array $query
- *
- * @return void
- */
-function wplt_tick_column_orderby( $query ) {
- $orderby = $query->get( 'orderby');
-
- if( $orderby == 'ticks' ) {
- $query->set('meta_key','_wplt_file_count');
- $query->set('orderby','meta_value_num');
- }
-}
-add_action( 'pre_get_posts', 'wplt_tick_column_orderby' );
\ No newline at end of file
diff --git a/includes/class-wpliveticker2.php b/includes/class-wpliveticker2.php
index 5fff92a..086582e 100644
--- a/includes/class-wpliveticker2.php
+++ b/includes/class-wpliveticker2.php
@@ -14,6 +14,13 @@ defined( 'ABSPATH' ) || exit;
* WP Liveticker 2.
*/
class WPLiveticker2 {
+ /**
+ * Options tag.
+ *
+ * @var string OPTIONS
+ */
+ const VERSION = '1.0.0';
+
/**
* Options tag.
*
@@ -58,6 +65,9 @@ class WPLiveticker2 {
// Add shortcode.
add_shortcode( 'liveticker', array( 'WPLiveticker2', 'shortcode_ticker_show' ) );
+ // Enqueue styles.
+ add_action( 'wp_footer', array( 'WPLiveticker2', 'enqueue_styles' ) );
+
// Admin only actions.
if ( is_admin() ) {
// Add dashboard "right now" functionality.
@@ -187,6 +197,16 @@ class WPLiveticker2 {
return $output;
}
+ /**
+ * Register frontend CSS.
+ */
+ public static function enqueue_styles() {
+ // Only add if shortcode is present.
+ if ( self::$shortcode_present ) {
+ wp_enqueue_style( 'wplt-css', WPLT2_BASE . 'styles/wp-liveticker2.min.css', '', self::VERSION, 'all' );
+ }
+ }
+
/**
* Update options.
*
diff --git a/styles/wp-liveticker2.min.css b/styles/wp-liveticker2.min.css
new file mode 100644
index 0000000..8c88e61
--- /dev/null
+++ b/styles/wp-liveticker2.min.css
@@ -0,0 +1 @@
+ul.wplt2_ticker{list-style-type:none}li.wplt2_tick{background-color:#f5f5f5;margin:.1em;padding:.1em .3em}li.wplt2_tick p{margin:.3em}span.wplt2_tick_time{color:#002c58;font-size:.7em;font-style:italic}span.wplt2_tick_title{color:#002c58;font-weight:700;margin-left:.5em}p.wplt2_tick_content{margin-top:-.7em;text-indent:.5em}ul.wplt_2widget{list-style-type:none;margin-top:-.5em}ul.wplt2_widget li{text-align:left}span.wplt2_widget_time{font-size:.7em;font-style:italic}span.wplt2_widget_content{color:#002c58;text-indent:.2em}span.wplt2_widget_content_new{color:maroon;text-indent:.2em}p.wplt2_widget_link{text-align:right}
diff --git a/wp-liveticker2.php b/wp-liveticker2.php
index 153efd3..007bfee 100644
--- a/wp-liveticker2.php
+++ b/wp-liveticker2.php
@@ -36,7 +36,7 @@ defined( 'ABSPATH' ) || exit;
// Constants.
define( 'WPLT2_FILE', __FILE__ );
define( 'WPLT2_DIR', plugin_dir_path( __FILE__ ) );
-define( 'WPLT2_BASE', plugin_basename( __FILE__ ) );
+define( 'WPLT2_BASE', plugin_dir_url( __FILE__ ) );
// System Hooks.
add_action( 'init', array( 'WPLiveticker2', 'register_types' ) );