Пример #1
0
<?php

get_header();
?>

	<div id="primary">
		<div id="content" role="main">
		
	<?php 
if (have_posts()) {
    while (have_posts()) {
        the_post();
        if (wats_check_visibility_rights()) {
            ?>
		<nav id="nav-single">
			<h3 class="assistive-text"><?php 
            _e('Post navigation', 'twentyeleven');
            ?>
</h3>
			<span class="nav-previous"><?php 
            previous_post_link('&larr; %link');
            ?>
</span>
			<span class="nav-next"><?php 
            next_post_link('%link &rarr;');
            ?>
</span>
		</nav>
	
		<article id="post-<?php 
            the_ID();
Пример #2
0
function wats_add_admin_page()
{
    global $wats_settings, $menu, $current_user;
    wats_load_settings();
    $plugin_url = trailingslashit(get_option('siteurl')) . 'wp-content/plugins/' . basename(dirname(__FILE__)) . '/';
    add_filter('media_upload_tabs', 'wats_media_upload_tabs');
    if ($current_user->user_login == $wats_settings['wats_guest_user']) {
        wats_customize_guest_admin();
    }
    if (function_exists('add_options_page')) {
        $page = add_options_page(__('Wats Options', 'WATS'), __('Wats Options', 'WATS'), 'administrator', basename(__FILE__), 'wats_options_admin_menu');
        add_action('admin_print_scripts-' . $page, 'wats_options_admin_head');
    }
    if (function_exists('add_menu_page') && function_exists('add_submenu_page')) {
        if ($current_user->user_login == $wats_settings['wats_guest_user']) {
            add_filter('list_terms_exclusions', 'wats_list_terms_exclusions');
        } else {
            if (current_user_can('edit_posts') == 1) {
                if (current_user_can('moderate_comments') == 0 && $wats_settings['comment_menuitem_visibility'] == 1) {
                    unset($menu[25]);
                    if (!empty($_SERVER["REQUEST_URI"])) {
                        $requesteduri = $_SERVER["REQUEST_URI"];
                    } else {
                        $requesteduri = getenv('REQUEST_URI');
                    }
                    $destpage = get_option('siteurl') . '/wp-admin/index.php';
                    $mypos = strpos($requesteduri, '/wp-admin/edit-comments.php');
                    if ($mypos !== false) {
                        wp_safe_redirect($destpage);
                    }
                }
                if (isset($_GET['post_type']) && $_GET['post_type'] == 'ticket' || isset($_GET['post']) && get_post_type($_GET['post']) == 'ticket') {
                    add_action('manage_posts_custom_column', 'wats_edit_post_custom_column', 10, 2);
                    add_action('manage_posts_columns', 'wats_edit_post_column');
                    //add_filter('list_terms_exclusions','wats_list_terms_exclusions');
                    add_action('admin_print_scripts', 'wats_ticket_edit_admin_head');
                    if ($wats_settings['ticket_edition_media_upload'] == 0) {
                        remove_action('media_buttons', 'media_buttons');
                    }
                    if (isset($_GET['post'])) {
                        global $post;
                        $post = get_post($_GET['post']);
                        if (wats_check_visibility_rights() == false) {
                            unset($post);
                            wp_die(__('You are not allowed to edit this item.'));
                        }
                    }
                }
            }
        }
    }
    add_action('show_user_profile', 'wats_admin_edit_user_profile');
    add_action('edit_user_profile', 'wats_admin_edit_user_profile');
    add_action('profile_update', 'wats_admin_save_user_profile');
    return;
}
Пример #3
0
function wats_comments_template($template)
{
    global $wp_query, $wats_settings;
    if (wats_is_ticket($wp_query->post) == true) {
        if (wats_check_visibility_rights()) {
            if ($wats_settings['template_selector'] == 0) {
                add_filter('comments_open', 'wats_ticket_comments_open', 10, 2);
                add_action('comment_form_comments_closed', 'wats_ticket_comments_closed', 10);
                if (wats_get_ticket_update_rights() == true) {
                    add_filter('comment_form_field_comment', 'wats_comment_form_after_fields', 10, 1);
                }
            } else {
                if (file_exists(get_stylesheet_directory() . '/comments-ticket.php')) {
                    $template = get_stylesheet_directory() . '/comments-ticket.php';
                } else {
                    $template = WATS_THEME_PATH . '/comments-ticket.php';
                }
            }
        } else {
            wp_die(__('You are not allowed to view this ticket.', 'WATS'));
        }
    }
    add_filter('comment_class', 'wats_comment_class');
    return $template;
}