Beispiel #1
0
function redirect_single_to_tax()
{
    global $post;
    // Only modify custom taxonomy template redirect
    if (is_single()) {
        $terms = get_the_terms(get_the_ID(), 'projets');
        if ($terms && !is_wp_error($terms)) {
            $term = array_pop($terms);
            $projet = $term->slug;
            if (current_user_can('edit_posts') && can_user_edit_this_project($projet) || current_user_can('administrator') || isset($_GET['comments']) && $_GET['comments'] === 'show') {
                return;
            }
            wp_safe_redirect(get_term_link($term));
            exit;
        }
    }
}
        ?>
" style="" data-isprojecteditor="<?php 
        echo can_user_edit_this_project($term_slug) ? 'true' : '';
        ?>
">

										<a href="<?php 
        echo $term_link;
        ?>
">
											<header class="headerProject">
													<?php 
        echo '<h2 class="titreProjet">' . $term_name . '</h2>';
        ?>
													<?php 
        if (can_user_edit_this_project($term_slug)) {
            ?>
															<svg class="icons edit-post" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 64.5 64.5" enable-background="new 0 0 64.5 64.5" xml:space="preserve" data-toggle="tooltip" data-placement="left" title="<?php 
            _e('Editor of this project', 'opendoc');
            ?>
" data-toggle-tooltip-color="#ef474b">
																	<g>
																		<circle fill="#EF474B" cx="32.2" cy="32.3" r="31.2"></circle>
																		<path fill="#293275" d="M51,20.2l-8.6-8.6L17.9,36.2l0,0l-4.3,12.9l12.9-4.3l0,0L51,20.2z M20.7,45.6L17.2,42l1.5-4.6l6.7,6.6
																			L20.7,45.6z"></path>
																	</g>
																</svg>
															<?php 
        }
        ?>
											</header>