__( 'Primary Navigation', 'Triton' )
) );
//SIDEBAR
function and_widgets_init(){
register_sidebar(array(
'name' => __('Right Sidebar', 'Triton'),
'id' => 'sidebar',
'description' => __('Right Sidebar', 'Triton'),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => ''
));
register_sidebar(array(
'name' => __('Midrow Widgets', 'Triton'),
'id' => 'mid_sidebar',
'description' => __('Widget Area for the Midrow', 'Triton'),
'before_widget' => '',
'after_widget' => '
',
'before_title' => ''
));
register_sidebar(array(
'name' => __('Footer Widgets', 'Triton'),
'id' => 'foot_sidebar',
'description' => __('Widget Area for the Footer', 'Triton'),
'before_widget' => '',
'after_widget' => '
',
'before_title' => ''
));
}
add_action( 'widgets_init', 'and_widgets_init' );
//Load Java Scripts to header
function and_head_js() {
if ( !is_admin() ) {
wp_enqueue_script('jquery');
wp_enqueue_script('triton_js',get_template_directory_uri().'/js/triton.js');
wp_enqueue_script('triton_other',get_template_directory_uri().'/js/other.js');
wp_enqueue_script('triton_newslider',get_template_directory_uri().'/js/featureList.js');
$option = get_option('and_options');
if($option['and_slider']== "Easyslider") {
wp_enqueue_script('triton_easySlider',get_template_directory_uri().'/js/easyslider.js');
}
if($option["and_diss_fbx"] == "1"){
} else {
wp_enqueue_style('triton_fancybox_css',get_template_directory_uri().'/css/fancybox.css');
wp_enqueue_script('triton_fancybox_js',get_template_directory_uri().'/js/fancybox.js');
}
}
}
add_action('wp_enqueue_scripts', 'and_head_js');
add_action('wp_footer', 'and_load_js');
function and_load_js() { ?>
_x('Slider', 'post type general name'),
'singular_name' => _x('Slider Item', 'post type singular name'),
'add_new' => _x('Add New', 'Slider item'),
'add_new_item' => __('Add New Slide', 'Triton'),
'edit_item' => __('Edit Slides', 'Triton'),
'new_item' => __('New Slider', 'Triton'),
'view_item' => __('View Sliders', 'Triton'),
'search_items' => __('Search Sliders', 'Triton'),
'menu_icon' => get_stylesheet_directory_uri() . 'images/article16.png',
'not_found' => __('Nothing found', 'Triton'),
'not_found_in_trash' => __('Nothing found in Trash', 'Triton'),
'parent_item_colon' => ''
);
$args = array(
'labels' => $labels,
'public' => true,
'exclude_from_search' => true,
'publicly_queryable' => true,
'show_ui' => true,
'query_var' => true,
'menu_icon' => get_stylesheet_directory_uri() . '/images/slider_button.png',
'rewrite' => false,
'capability_type' => 'post',
'hierarchical' => false,
'menu_position' => null,
'supports' => array('title','excerpt','thumbnail'),
'register_meta_box_cb' => 'and_add_meta'
);
register_post_type( 'slider' , $args );
}
//Slider Link Meta Box
add_action("admin_init", "and_add_meta");
function and_add_meta(){
add_meta_box("and_credits_meta", "Link", "and_credits_meta", "slider", "normal", "low");
}
function and_credits_meta( $post ) {
// Use nonce for verification
$anddata = get_post_meta($post->ID, 'and_slide_link', TRUE);
wp_nonce_field( 'and_meta_box_nonce', 'meta_box_nonce' );
// The actual fields for data entry
echo '';
}
//Save Slider Link Value
add_action('save_post', 'and_save_details');
function and_save_details($post_id){
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
return;
if( !isset( $_POST['meta_box_nonce'] ) || !wp_verify_nonce( $_POST['meta_box_nonce'], 'and_meta_box_nonce' ) ) return;
if ( !current_user_can( 'edit_post', $post_id ) )
return;
$anddata = esc_url( $_POST['and_sldurl'] );
update_post_meta($post_id, 'and_slide_link', $anddata);
return $anddata;
}
add_action('do_meta_boxes', 'and_slider_image_box');
function and_slider_image_box() {
remove_meta_box( 'postimagediv', 'slider', 'side' );
add_meta_box('postimagediv', __('Slide Image', 'Triton'), 'post_thumbnail_meta_box', 'slider', 'normal', 'high');
}
//TRITON get the first image of the post Function
function and_get_images($overrides = '', $exclude_thumbnail = false)
{
return get_posts(wp_parse_args($overrides, array(
'numberposts' => -1,
'post_parent' => get_the_ID(),
'post_type' => 'attachment',
'post_mime_type' => 'image',
'order' => 'ASC',
'exclude' => $exclude_thumbnail ? array(get_post_thumbnail_id()) : array(),
'orderby' => 'menu_order ID'
)));
}
//Custom Excerpt Length
function and_excerptlength_teaser($length) {
return 33;
}
function and_excerptlength_index($length) {
return 12;
}
function and_excerptmore($more) {
return '...';
}
function and_excerpt($length_callback='', $more_callback='') {
global $post;
if(function_exists($length_callback)){
add_filter('excerpt_length', $length_callback);
}
if(function_exists($more_callback)){
add_filter('excerpt_more', $more_callback);
}
$output = get_the_excerpt();
$output = apply_filters('wptexturize', $output);
$output = apply_filters('convert_chars', $output);
$output = ''.$output.'
';
echo $output;
}
//TRITON COMMENTS
function and_comment($comment, $args, $depth) {
$GLOBALS['comment'] = $comment; ?>
id="li-comment-">
comment_approved == '0') : ?>
id="li-comment-">