Jump to content


Photo
CatLoop

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



Best Answer anthalis , 28 January 2013 - 11:49 AM

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.

Go to the full post


  • Please log in to reply
6 replies to this topic

#1 seeyou30

seeyou30

    Advanced Member

  • Members
  • 61 posts
  • Framework Version:2.4
  • Country: Country Flag

Posted 21 January 2013 - 08:22 AM

Hi,

 

Id like to know if thes a way to make a navigation only between posts of one category chosen in Catloop?

 

Catloop category: http://hellokitchen.ru/blog/

 

A post within this category: http://hellokitchen....jamaca-de-dios/

 

 

Thanks!

 

 

What I want is on the attached image:

Attached Files



#2 Jenny

Jenny

    Advocate

  • Unicorn Store Dev

  • 2924 posts
  • LocationWV
  • Country: Country Flag

Posted 23 January 2013 - 03:00 PM

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



#3 anthalis

anthalis

    Advanced Member

  • Members

  • 60 posts
  • Framework Version:Dev. Latest. Always.
  • Country: Country Flag

Posted 23 January 2013 - 03:30 PM

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.wordpre.../next_post_link and http://codex.wordpre...vious_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 
	
	}
}


#4 seeyou30

seeyou30

    Advanced Member

  • Members
  • 61 posts
  • Framework Version:2.4
  • Country: Country Flag

Posted 24 January 2013 - 02:39 AM

anthalis,

thank you for your assistance.

 

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

 

http://hellokitchen....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

Attached Files



#5 anthalis

anthalis

    Advanced Member

  • Members

  • 60 posts
  • Framework Version:Dev. Latest. Always.
  • Country: Country Flag

Posted 28 January 2013 - 11:49 AM   Best Answer

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.



#6 seeyou30

seeyou30

    Advanced Member

  • Members
  • 61 posts
  • Framework Version:2.4
  • Country: Country Flag

Posted 04 February 2013 - 10:29 AM

ty,

anthalis

 

# 2 worked fine



#7 anthalis

anthalis

    Advanced Member

  • Members

  • 60 posts
  • Framework Version:Dev. Latest. Always.
  • Country: Country Flag

Posted 04 February 2013 - 05:04 PM

Great! Happy I could help.







Also tagged with one or more of these keywords: CatLoop