Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(function_exists("register_field_group"))
- {
- register_field_group(array (
- 'id' => 'acf_artist',
- 'title' => 'Artist',
- 'fields' => array (
- array (
- 'key' => 'field_53430486e8bcd',
- 'label' => 'Name',
- 'name' => 'name',
- 'type' => 'text',
- 'default_value' => '',
- 'placeholder' => '',
- 'prepend' => '',
- 'append' => '',
- 'formatting' => 'html',
- 'maxlength' => '',
- ),
- array (
- 'key' => 'field_5349740b0e0b1',
- 'label' => 'Biography',
- 'name' => 'biography',
- 'type' => 'textarea',
- 'default_value' => '',
- 'placeholder' => '',
- 'maxlength' => '',
- 'rows' => 8,
- 'formatting' => 'html',
- ),
- array (
- 'key' => 'field_53499ef3fb697',
- 'label' => 'Label',
- 'name' => 'label',
- 'type' => 'text',
- 'default_value' => '',
- 'placeholder' => '',
- 'prepend' => '',
- 'append' => '',
- 'formatting' => 'html',
- 'maxlength' => '',
- ),
- array (
- 'key' => 'field_53499f5f86a28',
- 'label' => 'Alias',
- 'name' => 'alias',
- 'type' => 'text',
- 'default_value' => '',
- 'placeholder' => '',
- 'prepend' => '',
- 'append' => '',
- 'formatting' => 'html',
- 'maxlength' => '',
- ),
- array (
- 'key' => 'field_534304ace8bd0',
- 'label' => 'Header Image',
- 'name' => 'header_image',
- 'type' => 'image',
- 'save_format' => 'id',
- 'preview_size' => 'full',
- 'library' => 'uploadedTo',
- ),
- array (
- 'key' => 'field_53430492e8bce',
- 'label' => 'Twitter',
- 'name' => 'twitter',
- 'type' => 'text',
- 'default_value' => '',
- 'placeholder' => '',
- 'prepend' => '',
- 'append' => '',
- 'formatting' => 'html',
- 'maxlength' => '',
- ),
- array (
- 'key' => 'field_534304a3e8bcf',
- 'label' => 'Facebook',
- 'name' => 'facebook',
- 'type' => 'text',
- 'default_value' => '',
- 'placeholder' => '',
- 'prepend' => '',
- 'append' => '',
- 'formatting' => 'html',
- 'maxlength' => '',
- ),
- array (
- 'key' => 'field_53496c9946ed5',
- 'label' => 'Soundcloud',
- 'name' => 'soundcloud',
- 'type' => 'text',
- 'default_value' => '',
- 'placeholder' => '',
- 'prepend' => '',
- 'append' => '',
- 'formatting' => 'html',
- 'maxlength' => '',
- ),
- array (
- 'key' => 'field_53712afb77833',
- 'label' => 'Slider Image',
- 'name' => 'slider_image',
- 'type' => 'image',
- 'save_format' => 'id',
- 'preview_size' => 'full',
- 'library' => 'all',
- ),
- ),
- 'location' => array (
- array (
- array (
- 'param' => 'post_type',
- 'operator' => '==',
- 'value' => 'artist',
- 'order_no' => 0,
- 'group_no' => 0,
- ),
- ),
- ),
- 'options' => array (
- 'position' => 'normal',
- 'layout' => 'no_box',
- 'hide_on_screen' => array (
- 0 => 'excerpt',
- ),
- ),
- 'menu_order' => 0,
- ));
- register_field_group(array (
- 'id' => 'acf_mixes',
- 'title' => 'Mixes',
- 'fields' => array (
- array (
- 'key' => 'field_53580a5e643a0',
- 'label' => 'Artist Name',
- 'name' => 'artist_name',
- 'type' => 'text',
- 'default_value' => '',
- 'placeholder' => '',
- 'prepend' => '',
- 'append' => '',
- 'formatting' => 'html',
- 'maxlength' => '',
- ),
- array (
- 'key' => 'field_53580a71643a1',
- 'label' => 'Location',
- 'name' => 'location',
- 'type' => 'text',
- 'default_value' => '',
- 'placeholder' => '',
- 'prepend' => '',
- 'append' => '',
- 'formatting' => 'html',
- 'maxlength' => '',
- ),
- array (
- 'key' => 'field_53580a76643a2',
- 'label' => 'TrackList',
- 'name' => 'tracklist',
- 'type' => 'textarea',
- 'default_value' => '',
- 'placeholder' => '',
- 'maxlength' => '',
- 'rows' => '',
- 'formatting' => 'html',
- ),
- array (
- 'key' => 'field_53580a4c6439f',
- 'label' => 'slider_image',
- 'name' => 'slider_image',
- 'type' => 'image',
- 'save_format' => 'id',
- 'preview_size' => 'full',
- 'library' => 'all',
- ),
- array (
- 'key' => 'field_53580a90643a3',
- 'label' => 'Date',
- 'name' => 'date',
- 'type' => 'text',
- 'default_value' => '',
- 'placeholder' => '',
- 'prepend' => '',
- 'append' => '',
- 'formatting' => 'html',
- 'maxlength' => '',
- ),
- array (
- 'key' => 'field_53580aa4643a4',
- 'label' => 'Information',
- 'name' => 'information',
- 'type' => 'text',
- 'default_value' => '',
- 'placeholder' => '',
- 'prepend' => '',
- 'append' => '',
- 'formatting' => 'html',
- 'maxlength' => '',
- ),
- array (
- 'key' => 'field_535815f609122',
- 'label' => 'Soundcloud ID',
- 'name' => 'soundcloud_id',
- 'type' => 'text',
- 'default_value' => '',
- 'placeholder' => '',
- 'prepend' => '',
- 'append' => '',
- 'formatting' => 'html',
- 'maxlength' => '',
- ),
- array (
- 'key' => 'field_535824d75832b',
- 'label' => 'Mixcloud ID',
- 'name' => 'mixcloud_id',
- 'type' => 'text',
- 'default_value' => '',
- 'placeholder' => '',
- 'prepend' => '',
- 'append' => '',
- 'formatting' => 'html',
- 'maxlength' => '',
- ),
- ),
- 'location' => array (
- array (
- array (
- 'param' => 'post_type',
- 'operator' => '==',
- 'value' => 'mix',
- 'order_no' => 0,
- 'group_no' => 0,
- ),
- ),
- ),
- 'options' => array (
- 'position' => 'normal',
- 'layout' => 'no_box',
- 'hide_on_screen' => array (
- 0 => 'excerpt',
- ),
- ),
- 'menu_order' => 0,
- ));
- register_field_group(array (
- 'id' => 'acf_news',
- 'title' => 'News',
- 'fields' => array (
- array (
- 'key' => 'field_536626b9fda97',
- 'label' => 'Small Image',
- 'name' => 'small_image',
- 'type' => 'image',
- 'save_format' => 'id',
- 'preview_size' => 'full',
- 'library' => 'all',
- ),
- array (
- 'key' => 'field_53711238ea71b',
- 'label' => 'Slider Image',
- 'name' => 'slider_image',
- 'type' => 'image',
- 'save_format' => 'id',
- 'preview_size' => 'full',
- 'library' => 'all',
- ),
- array (
- 'key' => 'field_537a590bc5325',
- 'label' => 'Index Image',
- 'name' => 'index_image',
- 'type' => 'image',
- 'save_format' => 'id',
- 'preview_size' => 'thumbnail',
- 'library' => 'all',
- ),
- array (
- 'key' => 'field_53805ee5d699b',
- 'label' => 'Singe Header Image',
- 'name' => 'single_header_image',
- 'type' => 'image',
- 'save_format' => 'id',
- 'preview_size' => 'full',
- 'library' => 'all',
- ),
- ),
- 'location' => array (
- array (
- array (
- 'param' => 'post_type',
- 'operator' => '==',
- 'value' => 'news',
- 'order_no' => 0,
- 'group_no' => 0,
- ),
- ),
- ),
- 'options' => array (
- 'position' => 'normal',
- 'layout' => 'no_box',
- 'hide_on_screen' => array (
- ),
- ),
- 'menu_order' => 0,
- ));
- register_field_group(array (
- 'id' => 'acf_page',
- 'title' => 'Page',
- 'fields' => array (
- array (
- 'key' => 'field_53529f69880dd',
- 'label' => 'Header Image',
- 'name' => 'header_image',
- 'type' => 'image',
- 'save_format' => 'id',
- 'preview_size' => 'full',
- 'library' => 'all',
- ),
- ),
- 'location' => array (
- array (
- array (
- 'param' => 'post_type',
- 'operator' => '==',
- 'value' => 'page',
- 'order_no' => 0,
- 'group_no' => 0,
- ),
- ),
- ),
- 'options' => array (
- 'position' => 'normal',
- 'layout' => 'no_box',
- 'hide_on_screen' => array (
- ),
- ),
- 'menu_order' => 0,
- ));
- register_field_group(array (
- 'id' => 'acf_single-track',
- 'title' => 'Single Track',
- 'fields' => array (
- array (
- 'key' => 'field_5349a87f0f393',
- 'label' => 'Title',
- 'name' => 'title',
- 'type' => 'text',
- 'default_value' => '',
- 'placeholder' => '',
- 'prepend' => '',
- 'append' => '',
- 'formatting' => 'html',
- 'maxlength' => '',
- ),
- array (
- 'key' => 'field_5349a89a0f395',
- 'label' => 'Artist',
- 'name' => 'artist',
- 'type' => 'text',
- 'default_value' => '',
- 'placeholder' => '',
- 'prepend' => '',
- 'append' => '',
- 'formatting' => 'html',
- 'maxlength' => '',
- ),
- array (
- 'key' => 'field_5349a8830f394',
- 'label' => 'Label',
- 'name' => 'label',
- 'type' => 'text',
- 'default_value' => '',
- 'placeholder' => '',
- 'prepend' => '',
- 'append' => '',
- 'formatting' => 'html',
- 'maxlength' => '',
- ),
- array (
- 'key' => 'field_534c380a3c812',
- 'label' => 'Track Text',
- 'name' => 'track_text',
- 'type' => 'textarea',
- 'default_value' => '',
- 'placeholder' => '',
- 'maxlength' => '',
- 'rows' => '',
- 'formatting' => 'html',
- ),
- array (
- 'key' => 'field_5349a8ad0f396',
- 'label' => 'Release Date',
- 'name' => 'release_date',
- 'type' => 'text',
- 'default_value' => '',
- 'placeholder' => '',
- 'prepend' => '',
- 'append' => '',
- 'formatting' => 'html',
- 'maxlength' => '',
- ),
- array (
- 'key' => 'field_534c37ff3c811',
- 'label' => 'SoundcloudLink',
- 'name' => 'soundcloudlink',
- 'type' => 'text',
- 'default_value' => '',
- 'placeholder' => '',
- 'prepend' => '',
- 'append' => '',
- 'formatting' => 'html',
- 'maxlength' => '',
- ),
- array (
- 'key' => 'field_535829c8fa6b7',
- 'label' => 'Youtube ID',
- 'name' => 'youtube_id',
- 'type' => 'text',
- 'default_value' => '',
- 'placeholder' => '',
- 'prepend' => '',
- 'append' => '',
- 'formatting' => 'html',
- 'maxlength' => '',
- ),
- array (
- 'key' => 'field_5352a6f01bfe1',
- 'label' => 'slider_image',
- 'name' => 'slider_image',
- 'type' => 'image',
- 'save_format' => 'id',
- 'preview_size' => 'full',
- 'library' => 'all',
- ),
- array (
- 'key' => 'field_53600bd49a0c4',
- 'label' => 'Beatport Link',
- 'name' => 'beatport_link',
- 'type' => 'text',
- 'default_value' => '',
- 'placeholder' => '',
- 'prepend' => '',
- 'append' => '',
- 'formatting' => 'html',
- 'maxlength' => '',
- ),
- ),
- 'location' => array (
- array (
- array (
- 'param' => 'post_type',
- 'operator' => '==',
- 'value' => 'tracks',
- 'order_no' => 0,
- 'group_no' => 0,
- ),
- ),
- ),
- 'options' => array (
- 'position' => 'normal',
- 'layout' => 'no_box',
- 'hide_on_screen' => array (
- 0 => 'the_content',
- ),
- ),
- 'menu_order' => 0,
- ));
- }
- // Thumbnail Support
- add_theme_support( 'post-thumbnails' );
- // Attach Stylesheets
- if( !function_exists("theme_styles") ) {
- function theme_styles() {
- // This is the compiled css file from LESS - this means you compile the LESS file locally and put it in the appropriate directory if you want to make any changes to the master bootstrap.css.
- wp_register_style( 'ffs', get_template_directory_uri() . '/library/css/ffs.css', array(), '1.0', 'all' );
- wp_enqueue_style( 'ffs' );
- }
- }
- add_action( 'wp_enqueue_scripts', 'theme_styles' );
- // Attach JS Files
- if( !function_exists( "themee_js" ) ) {
- function themee_js(){
- wp_enqueue_script( 'soundcloud', '//connect.soundcloud.com/sdk.js',array('jquery'),'','',true);
- if( !is_admin()){
- wp_deregister_script('jquery');
- wp_register_script('jquery', ("//code.jquery.com/jquery-1.11.0.min.js"),'','',true);
- wp_enqueue_script('jquery');
- }
- wp_enqueue_script( 'ffs_js', get_template_directory_uri() . '/library/js/ffs.js',array('jquery'),'','',true);
- if( is_page( 'News' )) {
- wp_enqueue_script( 'newsfeed', get_template_directory_uri().'/library/js/newsfeed.js',array(),false, true);
- }
- if( is_page( 'Artist' )) {
- wp_enqueue_script( 'artistSearch', get_template_directory_uri().'/library/js/artistsearch.js',array(),false, true);
- }
- }
- }
- add_action( 'wp_enqueue_scripts', 'themee_js' );
- // Menu
- function register_my_menu() {
- register_nav_menu('main-menu',__( 'Main Menu' ));
- }
- add_action( 'init', 'register_my_menu' );
- // Custom Post Types
- function Artist() {
- $labels = array(
- 'name' => _x( 'Artists', 'post type general name' ),
- 'singular_name' => _x( 'Artist', 'post type singular name' ),
- 'add_new' => _x( 'Add New Artist', 'artist' ),
- 'add_new_item' => __( 'Add New Artist' ),
- 'edit_item' => __( 'Edit Artist' ),
- 'new_item' => __( 'New Artist' ),
- 'all_items' => __( 'All Artists' ),
- 'view_item' => __( 'View Artist' ),
- 'search_items' => __( 'Search Artists' ),
- 'not_found' => __( 'No Artists found' ),
- 'not_found_in_trash' => __( 'No Artists found in the Trash' ),
- 'parent_item_colon' => '',
- 'menu_name' => 'Artists'
- );
- $args = array(
- 'labels' => $labels,
- 'description' => 'Holds our artists and artist information',
- 'taxonomies' => array('category', 'post_tag'),
- 'public' => true,
- 'menu_position' => 5,
- 'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments', 'tags' ),
- 'has_archive' => true,
- );
- register_post_type( 'Artist', $args );
- }
- function Tracks() {
- $labels = array(
- 'name' => _x( 'Tracks', 'post type general name' ),
- 'singular_name' => _x( 'Track', 'post type singular name' ),
- 'add_new' => _x( 'Add New Track', 'track' ),
- 'add_new_item' => __( 'Add New Track' ),
- 'edit_item' => __( 'Edit Track' ),
- 'new_item' => __( 'New Track' ),
- 'all_items' => __( 'All Track' ),
- 'view_item' => __( 'View Track' ),
- 'search_items' => __( 'Search Tracks' ),
- 'not_found' => __( 'No Tracks found' ),
- 'not_found_in_trash' => __( 'No Tracks found in the Trash' ),
- 'parent_item_colon' => '',
- 'menu_name' => 'Tracks'
- );
- $args = array(
- 'labels' => $labels,
- 'taxonomies' => array('category', 'post_tag'),
- 'description' => 'Holds our News information',
- 'public' => true,
- 'menu_position' => 5,
- 'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments', 'tags' ),
- 'has_archive' => true,
- );
- register_post_type( 'Tracks', $args );
- }
- function Mix() {
- $labels = array(
- 'name' => _x( 'Mix', 'post type general name' ),
- 'singular_name' => _x( 'Mix', 'post type singular name' ),
- 'add_new' => _x( 'Add New Mix', 'Mix' ),
- 'add_new_item' => __( 'Add New Mix' ),
- 'edit_item' => __( 'Edit Mix' ),
- 'new_item' => __( 'New Mix' ),
- 'all_items' => __( 'All Mix' ),
- 'view_item' => __( 'View Mix' ),
- 'search_items' => __( 'Search Mix' ),
- 'not_found' => __( 'No Mix found' ),
- 'not_found_in_trash' => __( 'No Mix found in the Trash' ),
- 'parent_item_colon' => '',
- 'menu_name' => 'Mix'
- );
- $args = array(
- 'labels' => $labels,
- 'description' => 'Holds our Mixs information',
- 'taxonomies' => array('category', 'post_tag'),
- 'public' => true,
- 'menu_position' => 5,
- 'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments', 'tags' ),
- 'has_archive' => true,
- );
- register_post_type( 'Mix', $args );
- }
- function News() {
- $labels = array(
- 'name' => _x( 'News', 'post type general name' ),
- 'singular_name' => _x( 'News', 'post type singular name' ),
- 'add_new' => _x( 'Add New News', 'News' ),
- 'add_new_item' => __( 'Add New News' ),
- 'edit_item' => __( 'Edit News' ),
- 'new_item' => __( 'New News' ),
- 'all_items' => __( 'All News' ),
- 'view_item' => __( 'View News' ),
- 'search_items' => __( 'Search News' ),
- 'not_found' => __( 'No News found' ),
- 'not_found_in_trash' => __( 'No News found in the Trash' ),
- 'parent_item_colon' => '',
- 'menu_name' => 'New'
- );
- $args = array(
- 'labels' => $labels,
- 'description' => 'Holds our Mixs information',
- 'taxonomies' => array('category', 'post_tag'),
- 'public' => true,
- 'menu_position' => 5,
- 'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments', 'tags' ),
- 'has_archive' => true,
- );
- register_post_type( 'News', $args );
- flush_rewrite_rules();
- }
- add_action( 'init', 'Artist' );
- add_action( 'init', 'Tracks' );
- add_action( 'init', 'Mix' );
- add_action( 'init', 'News');
- // Get News Feed
- function getNewsFeed() {
- $args = array(
- 'posts_per_page' => 20,
- 'post_type' => 'news',
- );
- $news = new WP_Query($args);
- $array = array();
- $i = 0;
- foreach ($news->posts as $post) {
- $postID = $post->ID;
- $array[$i] = array();
- $array[$i]['id'] = $post->ID;
- $array[$i]['title'] = $post->post_title;
- $array[$i]['permalink'] = get_post_permalink($postID);
- // Featured Image
- $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
- $array[$i]['featured_image'] = $image[0];
- // $array[$i]['description'] = $post->post_content;
- // $array[$i]['video'] = youtube(get_post_meta($post->ID, 'videos_video', true));
- // $array[$i]['thumb'] = get_post_meta($post->ID, 'videos_thumb', true);
- // $array[$i]['permalink'] = $post->post_name;
- // $array[$i]['episode'] = get_post_meta($post->ID, 'videos_episode', true);
- $i++;
- }
- echo json_encode($array);
- die();
- }
- add_action('wp_ajax_nopriv_getNewsFeed' , 'getNewsFeed');
- add_action('wp_ajax_getNewsFeed' , 'getNewsFeed');
- // End News Feed
- // Search Artist
- function searchArtist() {
- $artistName = $_POST["artist"];
- $args = array(
- 'posts_per_page' => 20,
- 'post_type' => 'artist',
- 'name' => $artistName,
- );
- $artist = new WP_Query($args);
- $array = array();
- $i = 0;
- foreach ($artist->posts as $post) {
- $postID = $post->ID;
- $array[$i] = array();
- $array[$i]['id'] = $post->ID;
- $array[$i]['title'] = $post->post_title;
- $array[$i]['permalink'] = get_post_permalink($postID);
- $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
- $array[$i]['featured_image'] = $image[0];
- $i++;
- }
- echo json_encode($array);
- die();
- }
- add_action('wp_ajax_nopriv_searchArtist' , 'searchArtist');
- add_action('wp_ajax_searchArtist' , 'searchArtist');
- // Store Email Adddress
- function storeUserEmails() {
- $emailAddress = $_POST["UserEmails"];
- $con=mysqli_connect("localhost","root","root","upfrontemail");
- // Check connection
- if (mysqli_connect_errno()) {
- echo "Failed to connect to MySQL: " . mysqli_connect_error();
- die;
- }
- if ($emailAddress === null || $emailAddress == "") {
- echo "error";
- }
- else {
- $query="INSERT INTO upfrontemail (id, emailaddress) VALUES('', '$emailAddress')";
- mysql_query($query);
- echo $query;
- }
- mysqli_close($con);
- die();
- }
- add_action('wp_ajax_nopriv_storeUserEmails' , 'storeUserEmails');
- add_action('wp_ajax_storeUserEmails' , 'storeUserEmails');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement