Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Center area post/pages » Excerpts, Read more, Pagination »

[SOLVED] Hide next/previous navigation bar if there is just one post in a category...


  #1  
Old Mar 3, 2010, 04:53 PM
chiara7's Avatar
chiara7
 
18 posts · Sep 2009
Budapest - Hungary
Hy,
on sigle post pages I restricted the next/previous navigation to show only posts from the same category.
http://forum.bytesforall.com/showthread.php?t=4914

Is there any solution to hide navigation bar, if there is just one post in the category?

Thanks...
  #2  
Old Mar 3, 2010, 05:12 PM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
The problem is that a single post page is a single post page weither you get to it via it's category, recent post link or from the blog page. So there is no way to tell if you should use the navagation or not.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #3  
Old Mar 4, 2010, 06:25 AM
chiara7's Avatar
chiara7
 
18 posts · Sep 2009
Budapest - Hungary
Thank You, Juggledad, I understand....
And in a different way? It's possible "say to the navigation bar": if there is no content to show, don't display? I mean my setting is not to show home link in navigation bar, so if a category has one post, in the navigation bar there is no content...
  #4  
Old Mar 4, 2010, 06:51 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
the nav bars wont show unless you have more than one post in a category
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #5  
Old Mar 4, 2010, 07:29 AM
chiara7's Avatar
chiara7
 
18 posts · Sep 2009
Budapest - Hungary
Juggledad: Could You please have a look at this:
http://elcamino.joljarok.hu/repulo-v...ni-a-caminora/
(Category: Utazás)
this is an example for one post in category on my page. And nav bar is empty... but there is.

The code for navigation on single post pages:
/* Next/Previous POST Links (on single post pages)
in next_post_link "next" means newer posts
Available parameters for $location: Top, Middle, Bottom. Default: Top */

function bfa_next_previous_post_links($location = "Top") {

global $bfa_ata;

if ( is_single() AND strpos($bfa_ata['location_single_next_prev'],$location) !== FALSE AND

// don't display on WP Email pages
intval(get_query_var('email')) != 1 ) {

echo '<div class="navigation-'.strtolower($location).'">
<div class="older' . ($bfa_ata['home_single_next_prev'] != '' ?
'-home' : '') . '">';

$bfa_ata['next_prev_orientation'] == 'Older Left, Newer Right' ?
previous_post_link('%link &raquo;', '%title', TRUE) :
next_post_link('&laquo; %link', '%title', TRUE);

echo ' &nbsp;</div>' . ($bfa_ata['home_single_next_prev'] != '' ?
'<div class="home"><a href="' . $bfa_ata['get_option_home'] . '/">' .
$bfa_ata['home_single_next_prev'] . '</a></div>' : '') .
'<div class="newer' . ($bfa_ata['home_single_next_prev'] != '' ?
'-home' : '') . '">&nbsp; ';

$bfa_ata['next_prev_orientation'] == 'Older Left, Newer Right' ?
next_post_link('&laquo; %link', '%title', TRUE) :
previous_post_link('%link &raquo;', '%title', TRUE);

echo '</div><div class="clearboth"></div></div>';

}

}
  #6  
Old Mar 6, 2010, 05:05 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
oops, your right I had mine at the bottom of the page so I didn't see the space there.
edit bfa_next_previous_links.php and find line 79 (version 3.4.6) and change it from
HTML Code:
	if ( !is_single() AND !is_page() AND 
to
HTML Code:
	if ( !is_single() AND !is_page() AND !is_category() AND
and I think that will do what you want.

-------------------
update: this won't work eithor, it shuts of nav for all category pages. There is nothing to distinguish a category page that has onel one post vers one that has multiple posts.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support

Last edited by juggledad; Mar 6, 2010 at 05:13 AM.
  #7  
Old Mar 7, 2010, 05:42 PM
chiara7's Avatar
chiara7
 
18 posts · Sep 2009
Budapest - Hungary
Thanks Juggledad...

I found the solution (red=inserts):

/* Next/Previous POST Links (on single post pages)
in next_post_link "next" means newer posts
Available parameters for $location: Top, Middle, Bottom. Default: Top */

function bfa_next_previous_post_links($location = "Top") {

global $bfa_ata;

if ( is_single() AND strpos($bfa_ata['location_single_next_prev'],$location) !== FALSE AND

// don't display on WP Email pages
intval(get_query_var('email')) != 1 ) {

foreach((get_the_category()) as $category)
{
$catcount =$category->category_count;
//echo $catcount;
}
if ($catcount > 1)
{


echo '<div class="navigation-'.strtolower($location).'">

<div class="older' . ($bfa_ata['home_single_next_prev'] != '' ?

'-home' : '') . '">';


$bfa_ata['next_prev_orientation'] == 'Older Left, Newer Right' ?

previous_post_link('%link &raquo;', '%title', TRUE) :

next_post_link('&laquo; %link', '%title', TRUE);



echo ' &nbsp;</div>' . ($bfa_ata['home_single_next_prev'] != '' ?

'<div class="home"><a href="' . $bfa_ata['get_option_home'] . '/">' .

$bfa_ata['home_single_next_prev'] . '</a></div>' : '') .

'<div class="newer' . ($bfa_ata['home_single_next_prev'] != '' ?

'-home' : '') . '">&nbsp; ';



$bfa_ata['next_prev_orientation'] == 'Older Left, Newer Right' ?

next_post_link('&laquo; %link', '%title', TRUE) :

previous_post_link('%link &raquo;', '%title', TRUE);


echo '</div><div class="clearboth"></div></div>';

}
}

}

Bookmarks



Similar Threads
Thread Thread Starter Forum Replies Last Post
Filter next/previous navigation by category garyrw Post-Kicker, -Byline & -Footer 13 Jan 8, 2010 04:28 PM
Can the next/previous post navigation be constrained to the current category ? 3ukman Header configuration & styling 1 Aug 29, 2009 10:14 AM
How do I hide a parent page in the top navigation bar freyakat Page & Category Menu Bars 1 Aug 26, 2009 07:29 PM
[SOLVED] How do I move next/previous navigation to the bottom of the post evany Post-Kicker, -Byline & -Footer 1 Jun 7, 2009 07:41 AM
next and previous navigation in the consulted category lkjc Page & Category Menu Bars 4 Jun 1, 2009 06:25 PM


All times are GMT -6. The time now is 12:06 AM.


Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.