Ejemplo n.º 1
0
/**
 * Display navigation to next/previous pages when applicable
 */
function tst_content_nav($nav_id, $query = null)
{
    global $wp_query, $post;
    $nav_class = is_single() || is_single_member() ? 'nav-post' : 'nav-paging';
    ?>
	<nav role="navigation" id="<?php 
    echo esc_attr($nav_id);
    ?>
" class="clearfix <?php 
    echo $nav_class;
    ?>
">		

	<?php 
    if (is_single()) {
        // navigation links for single posts
        ?>
		
	<div class="nextprev">
		<?php 
        //previous_post_link( '<span class="nav-previous">%link</span>', __('&laquo; prev.', 'tst') );
        //next_post_link('<span class="nav-next">%link</span>', __('next. &raquo;', 'tst') );
        $back = home_url('tasks');
        ?>
		<span class="nav-link"><a href="<?php 
        echo $back;
        ?>
">&laquo; <?php 
        _e('Back to tasks list', 'tst');
        ?>
</a></span>
	</div>
	<?php 
    } elseif (is_single_member()) {
        ?>
		<div class="nextprev">
		<?php 
        $back = home_url('members');
        ?>
		<span class="nav-link"><a href="<?php 
        echo $back;
        ?>
">&laquo; <?php 
        _e('Back to members list', 'tst');
        ?>
</a></span>
	</div>
	<?php 
    } elseif (is_page('members')) {
        ?>
		<div class="pull-right">
		<?php 
        $p = tst_members_paging($query, false);
        if (!empty($p)) {
            echo $p;
        }
        ?>
		</div>
	<?php 
    } else {
        // pagination
        ?>
		<div class="pull-right">
		<?php 
        $p = frl_paginate_links($query, false);
        if (!empty($p)) {
            echo $p;
        }
        ?>
		
		</div>
	<?php 
    }
    ?>

	</nav>
	<?php 
}
Ejemplo n.º 2
0
function frl_query_screen($atts)
{
    global $wp_query;
    extract(shortcode_atts(array('q' => '', 'paging' => 0, 'format' => 'content', 'css' => ''), $atts));
    $q = str_replace('+', '&', $q);
    //on singlural pages page=2 qv detects paging
    if (isset($wp_query->query_vars['paged']) && $wp_query->query_vars['paged'] > 0) {
        $q .= "&paged=" . $wp_query->query_vars['paged'];
    } elseif (isset($wp_query->query_vars['page']) && $wp_query->query_vars['page'] > 0) {
        $q .= "&page=" . $wp_query->query_vars['page'] . "&paged=" . $wp_query->query_vars['page'];
    }
    $query = new WP_Query($q);
    if (!$query->have_posts()) {
        return '';
    }
    $out = "";
    ob_start();
    echo "<div class='query-loop cf'>";
    while ($query->have_posts()) {
        $query->the_post();
        get_template_part($format);
    }
    wp_reset_postdata();
    if ($paging) {
        echo "<div class='pagination'>";
        frl_paginate_links($query);
        echo "</div>";
    }
    echo "</div>";
    $out = ob_get_contents();
    ob_end_clean();
    $css = esc_attr($css);
    return "<div class='frl-query {$css}'>{$out}</div>";
}