Advertisement
Guest User

Untitled

a guest
Jun 6th, 2014
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.99 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4.  
  5. if(function_exists("register_field_group"))
  6. {
  7. register_field_group(array (
  8. 'id' => 'acf_artist',
  9. 'title' => 'Artist',
  10. 'fields' => array (
  11. array (
  12. 'key' => 'field_53430486e8bcd',
  13. 'label' => 'Name',
  14. 'name' => 'name',
  15. 'type' => 'text',
  16. 'default_value' => '',
  17. 'placeholder' => '',
  18. 'prepend' => '',
  19. 'append' => '',
  20. 'formatting' => 'html',
  21. 'maxlength' => '',
  22. ),
  23. array (
  24. 'key' => 'field_5349740b0e0b1',
  25. 'label' => 'Biography',
  26. 'name' => 'biography',
  27. 'type' => 'textarea',
  28. 'default_value' => '',
  29. 'placeholder' => '',
  30. 'maxlength' => '',
  31. 'rows' => 8,
  32. 'formatting' => 'html',
  33. ),
  34. array (
  35. 'key' => 'field_53499ef3fb697',
  36. 'label' => 'Label',
  37. 'name' => 'label',
  38. 'type' => 'text',
  39. 'default_value' => '',
  40. 'placeholder' => '',
  41. 'prepend' => '',
  42. 'append' => '',
  43. 'formatting' => 'html',
  44. 'maxlength' => '',
  45. ),
  46. array (
  47. 'key' => 'field_53499f5f86a28',
  48. 'label' => 'Alias',
  49. 'name' => 'alias',
  50. 'type' => 'text',
  51. 'default_value' => '',
  52. 'placeholder' => '',
  53. 'prepend' => '',
  54. 'append' => '',
  55. 'formatting' => 'html',
  56. 'maxlength' => '',
  57. ),
  58. array (
  59. 'key' => 'field_534304ace8bd0',
  60. 'label' => 'Header Image',
  61. 'name' => 'header_image',
  62. 'type' => 'image',
  63. 'save_format' => 'id',
  64. 'preview_size' => 'full',
  65. 'library' => 'uploadedTo',
  66. ),
  67. array (
  68. 'key' => 'field_53430492e8bce',
  69. 'label' => 'Twitter',
  70. 'name' => 'twitter',
  71. 'type' => 'text',
  72. 'default_value' => '',
  73. 'placeholder' => '',
  74. 'prepend' => '',
  75. 'append' => '',
  76. 'formatting' => 'html',
  77. 'maxlength' => '',
  78. ),
  79. array (
  80. 'key' => 'field_534304a3e8bcf',
  81. 'label' => 'Facebook',
  82. 'name' => 'facebook',
  83. 'type' => 'text',
  84. 'default_value' => '',
  85. 'placeholder' => '',
  86. 'prepend' => '',
  87. 'append' => '',
  88. 'formatting' => 'html',
  89. 'maxlength' => '',
  90. ),
  91. array (
  92. 'key' => 'field_53496c9946ed5',
  93. 'label' => 'Soundcloud',
  94. 'name' => 'soundcloud',
  95. 'type' => 'text',
  96. 'default_value' => '',
  97. 'placeholder' => '',
  98. 'prepend' => '',
  99. 'append' => '',
  100. 'formatting' => 'html',
  101. 'maxlength' => '',
  102. ),
  103. array (
  104. 'key' => 'field_53712afb77833',
  105. 'label' => 'Slider Image',
  106. 'name' => 'slider_image',
  107. 'type' => 'image',
  108. 'save_format' => 'id',
  109. 'preview_size' => 'full',
  110. 'library' => 'all',
  111. ),
  112. ),
  113. 'location' => array (
  114. array (
  115. array (
  116. 'param' => 'post_type',
  117. 'operator' => '==',
  118. 'value' => 'artist',
  119. 'order_no' => 0,
  120. 'group_no' => 0,
  121. ),
  122. ),
  123. ),
  124. 'options' => array (
  125. 'position' => 'normal',
  126. 'layout' => 'no_box',
  127. 'hide_on_screen' => array (
  128. 0 => 'excerpt',
  129. ),
  130. ),
  131. 'menu_order' => 0,
  132. ));
  133. register_field_group(array (
  134. 'id' => 'acf_mixes',
  135. 'title' => 'Mixes',
  136. 'fields' => array (
  137. array (
  138. 'key' => 'field_53580a5e643a0',
  139. 'label' => 'Artist Name',
  140. 'name' => 'artist_name',
  141. 'type' => 'text',
  142. 'default_value' => '',
  143. 'placeholder' => '',
  144. 'prepend' => '',
  145. 'append' => '',
  146. 'formatting' => 'html',
  147. 'maxlength' => '',
  148. ),
  149. array (
  150. 'key' => 'field_53580a71643a1',
  151. 'label' => 'Location',
  152. 'name' => 'location',
  153. 'type' => 'text',
  154. 'default_value' => '',
  155. 'placeholder' => '',
  156. 'prepend' => '',
  157. 'append' => '',
  158. 'formatting' => 'html',
  159. 'maxlength' => '',
  160. ),
  161. array (
  162. 'key' => 'field_53580a76643a2',
  163. 'label' => 'TrackList',
  164. 'name' => 'tracklist',
  165. 'type' => 'textarea',
  166. 'default_value' => '',
  167. 'placeholder' => '',
  168. 'maxlength' => '',
  169. 'rows' => '',
  170. 'formatting' => 'html',
  171. ),
  172. array (
  173. 'key' => 'field_53580a4c6439f',
  174. 'label' => 'slider_image',
  175. 'name' => 'slider_image',
  176. 'type' => 'image',
  177. 'save_format' => 'id',
  178. 'preview_size' => 'full',
  179. 'library' => 'all',
  180. ),
  181. array (
  182. 'key' => 'field_53580a90643a3',
  183. 'label' => 'Date',
  184. 'name' => 'date',
  185. 'type' => 'text',
  186. 'default_value' => '',
  187. 'placeholder' => '',
  188. 'prepend' => '',
  189. 'append' => '',
  190. 'formatting' => 'html',
  191. 'maxlength' => '',
  192. ),
  193. array (
  194. 'key' => 'field_53580aa4643a4',
  195. 'label' => 'Information',
  196. 'name' => 'information',
  197. 'type' => 'text',
  198. 'default_value' => '',
  199. 'placeholder' => '',
  200. 'prepend' => '',
  201. 'append' => '',
  202. 'formatting' => 'html',
  203. 'maxlength' => '',
  204. ),
  205. array (
  206. 'key' => 'field_535815f609122',
  207. 'label' => 'Soundcloud ID',
  208. 'name' => 'soundcloud_id',
  209. 'type' => 'text',
  210. 'default_value' => '',
  211. 'placeholder' => '',
  212. 'prepend' => '',
  213. 'append' => '',
  214. 'formatting' => 'html',
  215. 'maxlength' => '',
  216. ),
  217. array (
  218. 'key' => 'field_535824d75832b',
  219. 'label' => 'Mixcloud ID',
  220. 'name' => 'mixcloud_id',
  221. 'type' => 'text',
  222. 'default_value' => '',
  223. 'placeholder' => '',
  224. 'prepend' => '',
  225. 'append' => '',
  226. 'formatting' => 'html',
  227. 'maxlength' => '',
  228. ),
  229. ),
  230. 'location' => array (
  231. array (
  232. array (
  233. 'param' => 'post_type',
  234. 'operator' => '==',
  235. 'value' => 'mix',
  236. 'order_no' => 0,
  237. 'group_no' => 0,
  238. ),
  239. ),
  240. ),
  241. 'options' => array (
  242. 'position' => 'normal',
  243. 'layout' => 'no_box',
  244. 'hide_on_screen' => array (
  245. 0 => 'excerpt',
  246. ),
  247. ),
  248. 'menu_order' => 0,
  249. ));
  250. register_field_group(array (
  251. 'id' => 'acf_news',
  252. 'title' => 'News',
  253. 'fields' => array (
  254. array (
  255. 'key' => 'field_536626b9fda97',
  256. 'label' => 'Small Image',
  257. 'name' => 'small_image',
  258. 'type' => 'image',
  259. 'save_format' => 'id',
  260. 'preview_size' => 'full',
  261. 'library' => 'all',
  262. ),
  263. array (
  264. 'key' => 'field_53711238ea71b',
  265. 'label' => 'Slider Image',
  266. 'name' => 'slider_image',
  267. 'type' => 'image',
  268. 'save_format' => 'id',
  269. 'preview_size' => 'full',
  270. 'library' => 'all',
  271. ),
  272. array (
  273. 'key' => 'field_537a590bc5325',
  274. 'label' => 'Index Image',
  275. 'name' => 'index_image',
  276. 'type' => 'image',
  277. 'save_format' => 'id',
  278. 'preview_size' => 'thumbnail',
  279. 'library' => 'all',
  280. ),
  281. array (
  282. 'key' => 'field_53805ee5d699b',
  283. 'label' => 'Singe Header Image',
  284. 'name' => 'single_header_image',
  285. 'type' => 'image',
  286. 'save_format' => 'id',
  287. 'preview_size' => 'full',
  288. 'library' => 'all',
  289. ),
  290. ),
  291. 'location' => array (
  292. array (
  293. array (
  294. 'param' => 'post_type',
  295. 'operator' => '==',
  296. 'value' => 'news',
  297. 'order_no' => 0,
  298. 'group_no' => 0,
  299. ),
  300. ),
  301. ),
  302. 'options' => array (
  303. 'position' => 'normal',
  304. 'layout' => 'no_box',
  305. 'hide_on_screen' => array (
  306. ),
  307. ),
  308. 'menu_order' => 0,
  309. ));
  310. register_field_group(array (
  311. 'id' => 'acf_page',
  312. 'title' => 'Page',
  313. 'fields' => array (
  314. array (
  315. 'key' => 'field_53529f69880dd',
  316. 'label' => 'Header Image',
  317. 'name' => 'header_image',
  318. 'type' => 'image',
  319. 'save_format' => 'id',
  320. 'preview_size' => 'full',
  321. 'library' => 'all',
  322. ),
  323. ),
  324. 'location' => array (
  325. array (
  326. array (
  327. 'param' => 'post_type',
  328. 'operator' => '==',
  329. 'value' => 'page',
  330. 'order_no' => 0,
  331. 'group_no' => 0,
  332. ),
  333. ),
  334. ),
  335. 'options' => array (
  336. 'position' => 'normal',
  337. 'layout' => 'no_box',
  338. 'hide_on_screen' => array (
  339. ),
  340. ),
  341. 'menu_order' => 0,
  342. ));
  343. register_field_group(array (
  344. 'id' => 'acf_single-track',
  345. 'title' => 'Single Track',
  346. 'fields' => array (
  347. array (
  348. 'key' => 'field_5349a87f0f393',
  349. 'label' => 'Title',
  350. 'name' => 'title',
  351. 'type' => 'text',
  352. 'default_value' => '',
  353. 'placeholder' => '',
  354. 'prepend' => '',
  355. 'append' => '',
  356. 'formatting' => 'html',
  357. 'maxlength' => '',
  358. ),
  359. array (
  360. 'key' => 'field_5349a89a0f395',
  361. 'label' => 'Artist',
  362. 'name' => 'artist',
  363. 'type' => 'text',
  364. 'default_value' => '',
  365. 'placeholder' => '',
  366. 'prepend' => '',
  367. 'append' => '',
  368. 'formatting' => 'html',
  369. 'maxlength' => '',
  370. ),
  371. array (
  372. 'key' => 'field_5349a8830f394',
  373. 'label' => 'Label',
  374. 'name' => 'label',
  375. 'type' => 'text',
  376. 'default_value' => '',
  377. 'placeholder' => '',
  378. 'prepend' => '',
  379. 'append' => '',
  380. 'formatting' => 'html',
  381. 'maxlength' => '',
  382. ),
  383. array (
  384. 'key' => 'field_534c380a3c812',
  385. 'label' => 'Track Text',
  386. 'name' => 'track_text',
  387. 'type' => 'textarea',
  388. 'default_value' => '',
  389. 'placeholder' => '',
  390. 'maxlength' => '',
  391. 'rows' => '',
  392. 'formatting' => 'html',
  393. ),
  394. array (
  395. 'key' => 'field_5349a8ad0f396',
  396. 'label' => 'Release Date',
  397. 'name' => 'release_date',
  398. 'type' => 'text',
  399. 'default_value' => '',
  400. 'placeholder' => '',
  401. 'prepend' => '',
  402. 'append' => '',
  403. 'formatting' => 'html',
  404. 'maxlength' => '',
  405. ),
  406. array (
  407. 'key' => 'field_534c37ff3c811',
  408. 'label' => 'SoundcloudLink',
  409. 'name' => 'soundcloudlink',
  410. 'type' => 'text',
  411. 'default_value' => '',
  412. 'placeholder' => '',
  413. 'prepend' => '',
  414. 'append' => '',
  415. 'formatting' => 'html',
  416. 'maxlength' => '',
  417. ),
  418. array (
  419. 'key' => 'field_535829c8fa6b7',
  420. 'label' => 'Youtube ID',
  421. 'name' => 'youtube_id',
  422. 'type' => 'text',
  423. 'default_value' => '',
  424. 'placeholder' => '',
  425. 'prepend' => '',
  426. 'append' => '',
  427. 'formatting' => 'html',
  428. 'maxlength' => '',
  429. ),
  430. array (
  431. 'key' => 'field_5352a6f01bfe1',
  432. 'label' => 'slider_image',
  433. 'name' => 'slider_image',
  434. 'type' => 'image',
  435. 'save_format' => 'id',
  436. 'preview_size' => 'full',
  437. 'library' => 'all',
  438. ),
  439. array (
  440. 'key' => 'field_53600bd49a0c4',
  441. 'label' => 'Beatport Link',
  442. 'name' => 'beatport_link',
  443. 'type' => 'text',
  444. 'default_value' => '',
  445. 'placeholder' => '',
  446. 'prepend' => '',
  447. 'append' => '',
  448. 'formatting' => 'html',
  449. 'maxlength' => '',
  450. ),
  451. ),
  452. 'location' => array (
  453. array (
  454. array (
  455. 'param' => 'post_type',
  456. 'operator' => '==',
  457. 'value' => 'tracks',
  458. 'order_no' => 0,
  459. 'group_no' => 0,
  460. ),
  461. ),
  462. ),
  463. 'options' => array (
  464. 'position' => 'normal',
  465. 'layout' => 'no_box',
  466. 'hide_on_screen' => array (
  467. 0 => 'the_content',
  468. ),
  469. ),
  470. 'menu_order' => 0,
  471. ));
  472. }
  473.  
  474. // Thumbnail Support
  475. add_theme_support( 'post-thumbnails' );
  476.  
  477. // Attach Stylesheets
  478. if( !function_exists("theme_styles") ) {
  479. function theme_styles() {
  480. // 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.
  481. wp_register_style( 'ffs', get_template_directory_uri() . '/library/css/ffs.css', array(), '1.0', 'all' );
  482.  
  483. wp_enqueue_style( 'ffs' );
  484.  
  485. }
  486. }
  487.  
  488. add_action( 'wp_enqueue_scripts', 'theme_styles' );
  489.  
  490. // Attach JS Files
  491. if( !function_exists( "themee_js" ) ) {
  492. function themee_js(){
  493.  
  494. wp_enqueue_script( 'soundcloud', '//connect.soundcloud.com/sdk.js',array('jquery'),'','',true);
  495.  
  496. if( !is_admin()){
  497. wp_deregister_script('jquery');
  498. wp_register_script('jquery', ("//code.jquery.com/jquery-1.11.0.min.js"),'','',true);
  499. wp_enqueue_script('jquery');
  500. }
  501.  
  502. wp_enqueue_script( 'ffs_js', get_template_directory_uri() . '/library/js/ffs.js',array('jquery'),'','',true);
  503.  
  504.  
  505. if( is_page( 'News' )) {
  506. wp_enqueue_script( 'newsfeed', get_template_directory_uri().'/library/js/newsfeed.js',array(),false, true);
  507. }
  508.  
  509.  
  510. if( is_page( 'Artist' )) {
  511. wp_enqueue_script( 'artistSearch', get_template_directory_uri().'/library/js/artistsearch.js',array(),false, true);
  512. }
  513.  
  514.  
  515. }
  516. }
  517.  
  518. add_action( 'wp_enqueue_scripts', 'themee_js' );
  519.  
  520. // Menu
  521.  
  522. function register_my_menu() {
  523. register_nav_menu('main-menu',__( 'Main Menu' ));
  524. }
  525. add_action( 'init', 'register_my_menu' );
  526.  
  527.  
  528.  
  529. // Custom Post Types
  530.  
  531. function Artist() {
  532. $labels = array(
  533. 'name' => _x( 'Artists', 'post type general name' ),
  534. 'singular_name' => _x( 'Artist', 'post type singular name' ),
  535. 'add_new' => _x( 'Add New Artist', 'artist' ),
  536. 'add_new_item' => __( 'Add New Artist' ),
  537. 'edit_item' => __( 'Edit Artist' ),
  538. 'new_item' => __( 'New Artist' ),
  539. 'all_items' => __( 'All Artists' ),
  540. 'view_item' => __( 'View Artist' ),
  541. 'search_items' => __( 'Search Artists' ),
  542. 'not_found' => __( 'No Artists found' ),
  543. 'not_found_in_trash' => __( 'No Artists found in the Trash' ),
  544. 'parent_item_colon' => '',
  545. 'menu_name' => 'Artists'
  546. );
  547. $args = array(
  548. 'labels' => $labels,
  549. 'description' => 'Holds our artists and artist information',
  550. 'taxonomies' => array('category', 'post_tag'),
  551. 'public' => true,
  552. 'menu_position' => 5,
  553. 'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments', 'tags' ),
  554. 'has_archive' => true,
  555. );
  556. register_post_type( 'Artist', $args );
  557. }
  558.  
  559. function Tracks() {
  560. $labels = array(
  561. 'name' => _x( 'Tracks', 'post type general name' ),
  562. 'singular_name' => _x( 'Track', 'post type singular name' ),
  563. 'add_new' => _x( 'Add New Track', 'track' ),
  564. 'add_new_item' => __( 'Add New Track' ),
  565. 'edit_item' => __( 'Edit Track' ),
  566. 'new_item' => __( 'New Track' ),
  567. 'all_items' => __( 'All Track' ),
  568. 'view_item' => __( 'View Track' ),
  569. 'search_items' => __( 'Search Tracks' ),
  570. 'not_found' => __( 'No Tracks found' ),
  571. 'not_found_in_trash' => __( 'No Tracks found in the Trash' ),
  572. 'parent_item_colon' => '',
  573. 'menu_name' => 'Tracks'
  574. );
  575. $args = array(
  576. 'labels' => $labels,
  577. 'taxonomies' => array('category', 'post_tag'),
  578. 'description' => 'Holds our News information',
  579. 'public' => true,
  580. 'menu_position' => 5,
  581. 'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments', 'tags' ),
  582. 'has_archive' => true,
  583. );
  584. register_post_type( 'Tracks', $args );
  585. }
  586.  
  587. function Mix() {
  588. $labels = array(
  589. 'name' => _x( 'Mix', 'post type general name' ),
  590. 'singular_name' => _x( 'Mix', 'post type singular name' ),
  591. 'add_new' => _x( 'Add New Mix', 'Mix' ),
  592. 'add_new_item' => __( 'Add New Mix' ),
  593. 'edit_item' => __( 'Edit Mix' ),
  594. 'new_item' => __( 'New Mix' ),
  595. 'all_items' => __( 'All Mix' ),
  596. 'view_item' => __( 'View Mix' ),
  597. 'search_items' => __( 'Search Mix' ),
  598. 'not_found' => __( 'No Mix found' ),
  599. 'not_found_in_trash' => __( 'No Mix found in the Trash' ),
  600. 'parent_item_colon' => '',
  601. 'menu_name' => 'Mix'
  602. );
  603. $args = array(
  604. 'labels' => $labels,
  605. 'description' => 'Holds our Mixs information',
  606. 'taxonomies' => array('category', 'post_tag'),
  607. 'public' => true,
  608. 'menu_position' => 5,
  609. 'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments', 'tags' ),
  610. 'has_archive' => true,
  611. );
  612. register_post_type( 'Mix', $args );
  613. }
  614.  
  615. function News() {
  616. $labels = array(
  617. 'name' => _x( 'News', 'post type general name' ),
  618. 'singular_name' => _x( 'News', 'post type singular name' ),
  619. 'add_new' => _x( 'Add New News', 'News' ),
  620. 'add_new_item' => __( 'Add New News' ),
  621. 'edit_item' => __( 'Edit News' ),
  622. 'new_item' => __( 'New News' ),
  623. 'all_items' => __( 'All News' ),
  624. 'view_item' => __( 'View News' ),
  625. 'search_items' => __( 'Search News' ),
  626. 'not_found' => __( 'No News found' ),
  627. 'not_found_in_trash' => __( 'No News found in the Trash' ),
  628. 'parent_item_colon' => '',
  629. 'menu_name' => 'New'
  630. );
  631. $args = array(
  632. 'labels' => $labels,
  633. 'description' => 'Holds our Mixs information',
  634. 'taxonomies' => array('category', 'post_tag'),
  635. 'public' => true,
  636. 'menu_position' => 5,
  637. 'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments', 'tags' ),
  638. 'has_archive' => true,
  639. );
  640. register_post_type( 'News', $args );
  641. flush_rewrite_rules();
  642. }
  643.  
  644. add_action( 'init', 'Artist' );
  645. add_action( 'init', 'Tracks' );
  646. add_action( 'init', 'Mix' );
  647. add_action( 'init', 'News');
  648.  
  649. // Get News Feed
  650.  
  651. function getNewsFeed() {
  652.  
  653. $args = array(
  654. 'posts_per_page' => 20,
  655. 'post_type' => 'news',
  656. );
  657.  
  658. $news = new WP_Query($args);
  659. $array = array();
  660. $i = 0;
  661.  
  662. foreach ($news->posts as $post) {
  663.  
  664. $postID = $post->ID;
  665.  
  666. $array[$i] = array();
  667. $array[$i]['id'] = $post->ID;
  668. $array[$i]['title'] = $post->post_title;
  669. $array[$i]['permalink'] = get_post_permalink($postID);
  670.  
  671. // Featured Image
  672. $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
  673. $array[$i]['featured_image'] = $image[0];
  674.  
  675. // $array[$i]['description'] = $post->post_content;
  676. // $array[$i]['video'] = youtube(get_post_meta($post->ID, 'videos_video', true));
  677. // $array[$i]['thumb'] = get_post_meta($post->ID, 'videos_thumb', true);
  678. // $array[$i]['permalink'] = $post->post_name;
  679. // $array[$i]['episode'] = get_post_meta($post->ID, 'videos_episode', true);
  680.  
  681. $i++;
  682. }
  683.  
  684. echo json_encode($array);
  685.  
  686. die();
  687.  
  688. }
  689.  
  690.  
  691. add_action('wp_ajax_nopriv_getNewsFeed' , 'getNewsFeed');
  692. add_action('wp_ajax_getNewsFeed' , 'getNewsFeed');
  693.  
  694.  
  695. // End News Feed
  696.  
  697. // Search Artist
  698.  
  699.  
  700. function searchArtist() {
  701.  
  702. $artistName = $_POST["artist"];
  703.  
  704. $args = array(
  705. 'posts_per_page' => 20,
  706. 'post_type' => 'artist',
  707. 'name' => $artistName,
  708. );
  709.  
  710. $artist = new WP_Query($args);
  711. $array = array();
  712. $i = 0;
  713.  
  714. foreach ($artist->posts as $post) {
  715.  
  716. $postID = $post->ID;
  717.  
  718. $array[$i] = array();
  719. $array[$i]['id'] = $post->ID;
  720. $array[$i]['title'] = $post->post_title;
  721. $array[$i]['permalink'] = get_post_permalink($postID);
  722. $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
  723. $array[$i]['featured_image'] = $image[0];
  724.  
  725. $i++;
  726.  
  727. }
  728.  
  729.  
  730.  
  731. echo json_encode($array);
  732.  
  733. die();
  734.  
  735. }
  736.  
  737.  
  738. add_action('wp_ajax_nopriv_searchArtist' , 'searchArtist');
  739. add_action('wp_ajax_searchArtist' , 'searchArtist');
  740.  
  741.  
  742. // Store Email Adddress
  743.  
  744. function storeUserEmails() {
  745.  
  746.  
  747. $emailAddress = $_POST["UserEmails"];
  748.  
  749.  
  750. $con=mysqli_connect("localhost","root","root","upfrontemail");
  751.  
  752. // Check connection
  753. if (mysqli_connect_errno()) {
  754. echo "Failed to connect to MySQL: " . mysqli_connect_error();
  755. die;
  756. }
  757.  
  758. if ($emailAddress === null || $emailAddress == "") {
  759.  
  760. echo "error";
  761.  
  762. }
  763. else {
  764.  
  765. $query="INSERT INTO upfrontemail (id, emailaddress) VALUES('', '$emailAddress')";
  766.  
  767. mysql_query($query);
  768.  
  769. echo $query;
  770.  
  771. }
  772.  
  773. mysqli_close($con);
  774.  
  775. die();
  776.  
  777. }
  778.  
  779.  
  780. add_action('wp_ajax_nopriv_storeUserEmails' , 'storeUserEmails');
  781. add_action('wp_ajax_storeUserEmails' , 'storeUserEmails');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement