Jump to content
seeyou30

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

Recommended Posts

Jenny    33
Jenny

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


Jenny :: Web designer at Simple Mama (follow me at @simplemamacom)

Check out Share Me, a social sharing add-on for DMS that is super simple to set up.

Share this post


Link to post
Share on other sites
anthalis    5
anthalis

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
seeyou30    1
seeyou30
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
anthalis    5
anthalis

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Similar Content

    • klausk
      By klausk+
      I really loved CatLoop on old pagelines. The dream section!! How do I get the same/similar in DMS? I've searched and cant figure. All I want to do is add category specific, paginated posts with thumbs, onto a regular page. I know there are non-DMS plugins that can do this, but I'd prefer sticking with Pagelines/DMS if at all poss. Thanks for any pointers.
    • tandan
      By tandan
      hi there, I have installed catloop in content area and would like to set a limit to how many display. Right now it paginates but this could get pretty long. Please advise how I can set this limit. 
      thank you!
    • erin-wsk
      By erin-wsk
      I'm trying to show a single post on a static page using the catloop section. I want it to show in traditional blog view with the photo and part of the text with a "read more" button. I've changed the pagelines options to show full post text and normally the read more would be automatic. However, for the catloop post- I'm still getting the full text.

      Is this possible? Thanks!
    • basmati
      By basmati
      hello, i created that same topic in pl forum - but danny told me to place it on the store forum with prefix catloop - so here we go again:
       
      i use font awesome icon font on my new page and it works well (under
      dev.). but i can't manage to get icon fonts to work within the text area
      of post excerpts (together with PL catloop plugin) - they simply won't
      show up. within post and pages and even in the footer nav i use font
      awesome without any problem.
       
      HTML for icon font is:
      <i class="icon-external-link"></i> example: from a static page with catloop category post excerpts (no
      icon font visible) - i click on read more - and now - within the post
      the icon font is visible. i think the catloop plugin causes the problem
      any ideas ?
       
      Edit: Sometimes the TinyMCE erases the HTML for icon font - when you switch to html mode and back! 
×