Doug Stewart avatar Doug Stewart committed 7778e53

Allow navigation elements to be hookable in The Loop.

(Search and Series results functionality yet to be determined.)

Fixes issue #9.

Comments (0)

Files changed (3)

includes/functions/hooks.php

 }
 add_action( 'wp_enqueue_scripts', 'lblg_enqueue_styles', 11 );
 
+function lblg_nav_top() {
+	do_action( 'lblg_nav_top' );
+}
+
+function lblg_nav_bottom() {
+	do_action( 'lblg_nav_bottom' );
+}
 /**
 * Output functions.
 *
 	}
 }
 
+// Output site breadcrumbs if Yoast's Breadcrumbs are available.
 function lblg_breadcrumbs(){
 	if ( function_exists('yoast_breadcrumb') && !is_home() ) {
 		yoast_breadcrumb('<p id="breadcrumbs">','</p>');
 }
 add_action( 'lblg_before_loop', 'lblg_breadcrumbs' );
 
+// Output navigation info at the top of the Loop.
+function lblg_topnav() {
+	if ( is_attachment() ) { ?>
+
+	<div class="navigation">
+		<div class="left"><?php previous_image_link( 0 ) ?></div>
+		<div class="right"><?php next_image_link( 0 ) ?></div>
+		<div class="clear"></div>
+	</div>		
+
+	<?php 
+	} elseif ( is_single() ) { ?>
+
+	<div class="navigation">
+		<div class="left"><?php previous_post_link() ?></div>
+		<div class="right"><?php next_post_link() ?></div>
+		<div class="clear"></div>
+	</div>
+	
+	<?php 
+	}
+}
+add_action( 'lblg_nav_top', 'lblg_topnav' );
+
+function lblg_bottomnav() { ?>
+	<div class="navigation">
+			<?php if(function_exists('wp_pagenavi')) {
+ 					wp_pagenavi(); 
+				} else { ?>
+		<div class="left"><?php next_posts_link('<span>&laquo;</span> Older Entries') ?></div>
+		<div class="right"><?php previous_posts_link('Newer Entries <span>&raquo;</span>') ?></div>
+		<div class="clear"></div>
+			<?php } ?>
+	</div>
+	<?php 
+}
+add_action( 'lblg_nav_bottom', 'lblg_bottomnav' );
+
 function lblg_post_info(){
 		?>
 		<div class="postinfo">
 <?php
 /**
- * 
+ * Template Name: Navigation
  */
 ?>
 	<!--hr /-->
 
-	<?php if ( is_single() ) { ?>
+	<?php if ( is_attachment() ) { ?>
+
+	<div class="navigation">
+		<div class="left"><?php previous_image_link( 0 ) ?></div>
+		<div class="right"><?php next_image_link( 0 ) ?></div>
+		<div class="clear"></div>
+	</div>		
+
+	<?php } elseif ( is_single() ) { ?>
 
 	<div class="navigation">
 		<div class="left"><?php previous_post_link() ?></div>
 	</div>
 
 	<?php } else { ?>
+
 	<div class="navigation">
 			<?php if(function_exists('wp_pagenavi')) {
  					wp_pagenavi(); 
  * @since 		Elbee-Elgee 1.0
  */
 
-lblg_before_loop(); ?>
-<?php 
+lblg_before_loop();
 	/* Start The Loop */ 
 	if (have_posts()) { 
 		while (have_posts()) { 
 			the_post();
 			/* Permalink navigation has to be inside the loop */ 
-			if (is_single()) get_template_part('navigation'); ?>
+			lblg_nav_top(); ?>
 		<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
 			<?php lblg_before_post_title(); ?>
 			
 			-->
 		</div>
 	<?php } /* End while */
-		if(is_home() || is_archive()) get_template_part('navigation');
+		lblg_nav_bottom();
 	} /*End loop*/
 	
-	lblg_after_loop(); 
+lblg_after_loop(); 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.