Archived

This topic is now archived and is closed to further replies.

  • 0

CatLoop Is there any way to make PL post navigation only between one category?

Question

6 answers to this question

Posted · Report post

Hi,

 

Issue 1: I can't really help on this since I don't know your site structure (categories, pages, etc. ). My guess is that it is an issue with this structure. If the tab that is highlighted is a category, it would kinda make sense for that to be highlighted instead of the blog page. Wordpress template priority goes from highest specificity towards the more general. So, for instance, if you have a category.php and a category-news.php wordpress would first look to category-news.php if applicable, and move to category.php if not. Of course, it is not a case of templates here, but the same logic might apply. The Recipes category takes priority over the more general "Blog" page. However, I have no idea how to work around that.

 

2. It could be as simple as reversing the order of the spans that wrap the links in the PostNav. This way you won't have to change any CSS. So the code would become:

<?php
/*
    Section: PostNav
    Author: PageLines
    Author URI: http://www.pagelines.com
    Description: Post Navigation - Shows titles for next and previous post.
    Class Name: PageLinesPostNav    
    Workswith: main-single
    Cloning: true
    Failswith: pagelines_special_pages()
*/
 
/**
 * Next/Prev Post Navigation Section
 *
 * @package PageLines Framework
 * @author PageLines
 */
class PageLinesPostNav extends PageLinesSection {
 
    /**
    * Section template.
    */
   function section_template() {
     
        pagelines_register_hook( 'pagelines_section_before_postnav' ); // Hook ?>
        <div class="post-nav fix"> 
            <span class="next"><?php previous_post_link('%link', '%title', TRUE) ?></span> 
            <span class="previous"><?php next_post_link('%link', '%title', TRUE) ?></span>
        </div>
<?php    pagelines_register_hook( 'pagelines_section_after_postnav' ); // Hook 
     
    }
}

It would effectively reverse the position of the links because one is set to float left another to the right.

 

Let me know if it worked.

Share this post


Link to post
Share on other sites

Posted · Report post

I have emailed the developer to make them aware of your topic since she has not responded here yet.

Share this post


Link to post
Share on other sites

Posted · Report post

Hi,

 

The issue you are raising is more about PostNav section.

 

I recently had the same issue with post navigation within the category - even if on a category page that section will loop through all the posts. It is doing that because it's coded to be just some pretty previous/next links. Since I had no hand in making it or have any plans on putting out new sections in the near future, I can't commit to improving it.

Once you are on a single post page, you basically no longer have anything left to do with CatLoop because you are on a single post template.  So the section where this change should be made is PostNav, but it has considerable limitations.

 

Below is a modified version of the PostNav section. Provided your blog posts are within a single category each, it should work flawlessly. However, if your posts are in multiple categories, there is no telling which category WordPress will choose to navigate through.

 

For more information refer to http://codex.wordpress.org/Function_Reference/next_post_link and http://codex.wordpress.org/Template_Tags/previous_post_link.

 

 

<?php
/*
	Section: PostNav
	Author: PageLines
	Author URI: http://www.pagelines.com
	Description: Post Navigation - Shows titles for next and previous post.
	Class Name: PageLinesPostNav	
	Workswith: main-single
	Cloning: true
	Failswith: pagelines_special_pages()
*/

/**
 * Next/Prev Post Navigation Section
 *
 * @package PageLines Framework
 * @author PageLines
 */
class PageLinesPostNav extends PageLinesSection {

	/**
	* Section template.
	*/
   function section_template() {
	
		pagelines_register_hook( 'pagelines_section_before_postnav' ); // Hook ?>
		<div class="post-nav fix"> 
			<span class="previous"><?php previous_post_link('%link', '%title', TRUE) ?></span> 
			<span class="next"><?php next_post_link('%link', '%title', TRUE) ?></span>
		</div>
<?php 	pagelines_register_hook( 'pagelines_section_after_postnav' ); // Hook 
	
	}
}

Share this post


Link to post
Share on other sites

Posted · Report post

ty,

anthalis

 

# 2 worked fine

Share this post


Link to post
Share on other sites

Posted · Report post

Great! Happy I could help.

Share this post


Link to post
Share on other sites

Posted · Report post

anthalis,

thank you for your assistance.

 

I replaced 2 lines of code in original section.php and now it looks much better!

 

http://hellokitchen.ru/4350/progulka-jamaca-de-dios/

 

 

I have some additional questions here (see pic attached):

 

 

1. The menu tab issue. It highlights different tab. Shoud be on Блог tab.

 

2. Also, do you happen to know if its possible to flip direction of the navigation in PostNav? For some reason I dont feel comfortable when I need to scroll the posts back with left arrow. Id like to have back arrow on the right and forward arrow on the left.

 

 

thank you for your kind advice

post-19578-0-77724200-1358995151_thumb.p

Share this post


Link to post
Share on other sites