Skip to content

Instantly share code, notes, and snippets.

@sunilw
Created May 8, 2014 03:25
Show Gist options
  • Save sunilw/2a9eb1f26f7f3922e47d to your computer and use it in GitHub Desktop.
Save sunilw/2a9eb1f26f7f3922e47d to your computer and use it in GitHub Desktop.
<?php
/**
* Plugin Name: UBCF Slideshow
* Description: slideshow for the testimonials page
* Version: 0.9
* Author: Sunil Williams
* Author URI: http://sunil.co.nz
*/
$dirName = dirname(__FILE__) ;
$baseName = basename(realpath($dirName));
include_once( $dirName. "/cpt_testimonials.php") ;
//
// we need this string in the document in order
// for our ajax calls to work
//
function add_admin_url_to_header() {
$admin_url = '"' . admin_url('admin-ajax.php') . '"' ;
echo '<script>var ajaxurl = ' . $admin_url . '</script>' ;
}
//add_action('wp_head','add_admin_url_to_header');
//
// this is the function that handles the ajax requests
//
function send_ajax() {
include_once("testimonials_handler.php") ;
die() ;
}
add_action('wp_ajax_send_ajax','send_ajax');
add_action('wp_ajax_nopriv_send_ajax','send_ajax');
// call our plugins css
function testimonialsUI_styles()
{
wp_enqueue_style(
'testimonialsUI_styles',
plugins_url() . '/ubcf_slideshow/css/testimonialsUI.css'
);
}
add_action( 'wp_enqueue_scripts', 'testimonialsUI_styles' );
// call our plugins js
function load_testimonial_behaviours()
{
wp_enqueue_script(
'testimonials_UI',
plugins_url() . '/ubcf_slideshow/js/testimonial-ui-behaviours.js',
array('jquery')
);
}
add_action('wp_enqueue_scripts', 'load_testimonial_behaviours');%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment