Topic: IE7 breaks image Pages that link to <a href="https://ozoneasylum.com/backlink?for=30148" title="Pages that link to Topic: IE7 breaks image" rel="nofollow" >Topic: IE7 breaks image\

 
Author Thread
SleepingWolf
Paranoid (IV) Inmate

From:
Insane since: Jul 2006

IP logged posted posted 03-25-2008 23:39 Edit Quote

This page
http://www.sleepingwolves.com/blog/?cat=20&paged=7
is properly rendered in FF. Only 1 image appears for the Next button. The text appears as well.

In IE7 the same page however, shows a truncated image as well (a remnant of the Previous button) without the corresponding test.

The Next and Previous Text that appears is from the standard WP script.
Anyone know where to start looking?
Thanks

Nature & Travel Photography
Main Entrance

zavaboy
Paranoid (IV) Inmate

From: f(x)
Insane since: Jun 2004

IP logged posted posted 03-26-2008 02:08 Edit Quote

I would guess it has something to do with line 152:

quote:
<li></a></li>



Removing the line when there is no "previous" would probably solve your problem.

SleepingWolf
Paranoid (IV) Inmate

From:
Insane since: Jul 2006

IP logged posted posted 03-26-2008 04:09 Edit Quote
quote:

zavaboy said:

I would guess it has something to do with line 152:quote:<li>&lt;/a&gt;&lt;/li&gt;Removing the line when there is no "previous" would probably solve your problem.



Hi
The code is dynamic. What it actually is:

code:
<li><?php next_posts_link('Previous') ?></a></li>
<li><?php previous_posts_link('Next') ?></a></li>



When it's the most current image, the Next button will disappear.
Problem is IE7 doesn't get it. FF does.

Nature & Travel Photography
Main Entrance

zavaboy
Paranoid (IV) Inmate

From: f(x)
Insane since: Jun 2004

IP logged posted posted 03-26-2008 08:09 Edit Quote

Here's what you need to do:

1. Find the next_posts_link and previous_posts_link functions.
2. Find where it outputs the link.
3. Add "<li>" before it and "</a></li>" after it.
4. Remove the HTML in the lines you just gave.

So, for example, lets say you find one of the two functions like this:

code:
function next_post_link ($which_one) {
  if ($links[$which_one]){
    echo '<a href="'.$links[$which_one].'">';
  }
}


Then all you do is change the line with the echo to this:

code:
echo '<li><a href="'.$links[$which_one].'"></a></li>';


And, those two lines you provided would turn into this:

code:
<?php next_posts_link('Previous') ?>
<?php previous_posts_link('Next') ?>


If you find the functions but don't know what to do, just paste them here and we'll work from there.

BTW: We need both functions changed because you have the same problem with the "next" link on the last page.

SleepingWolf
Paranoid (IV) Inmate

From:
Insane since: Jul 2006

IP logged posted posted 03-26-2008 23:54 Edit Quote

Hey Zava
Thanks for your help.
I realize that what I posted earlier was not accurate.

The code in the sidebar is not dynamic - it is not echo'd to create the sidebar.
Second, I realized my code was wrong. This is it corrected and i must add it is hard coded:

code:
<li><?php next_posts_link('Previous') ?></li>
<li><?php previous_posts_link('Next') ?></li>



When the post page is called, it brings in the sidebar. This is where it breaks.
The code above is now transformed into this:

code:
<li><a href="http://www.sleepingwolves.com/blog/?cat=20&amp;paged=2">Previous</a></li>
<li></li>
</ul>



because there is no "next" page it returns the tags with out a hyperlink.
I'll check the php code - but this is going to be tricky i think.

Nature & Travel Photography
Main Entrance

zavaboy
Paranoid (IV) Inmate

From: f(x)
Insane since: Jun 2004

IP logged posted posted 03-27-2008 05:23 Edit Quote

If this script is supported, you may want to contact the developer(s) about it and they could possibly provide a fix/update. First make sure you have the latest version of it. If you don't and there are upgrade directions, do so.

Nathus
Bipolar (III) Inmate

From: Minnesota
Insane since: Aug 2003

IP logged posted posted 03-27-2008 21:15 Edit Quote

The code for those functions is in the link-template.php file in the wp-includes directory.

If you change the code for the next_post_link function from

code:
function next_post_link($format='%link &raquo;', $link='%title', $in_same_cat = false, $excluded_categories = '') {
	$post = get_next_post($in_same_cat, $excluded_categories);
  
	if ( !$post )
		return;

	$title = $post->post_title;

	if ( empty($post->post_title) )
		$title = __('Next Post');
  
	$title = apply_filters('the_title', $title, $post);
        $string = '<a href="'.get_permalink($post->ID).'">';  
	$link = str_replace('%title', $title, $link);
	$link = $string . $link . '</a>';  

	$format = str_replace('%link', $link, $format);
	echo $format;
}



to

code:
function next_post_link($format='%link &raquo;', $link='%title', $in_same_cat = false, $excluded_categories = '',$wraptag='') {
	$post = get_next_post($in_same_cat, $excluded_categories);
  
	if ( !$post )
		return;

	$title = $post->post_title;

	if ( empty($post->post_title) )
		$title = __('Next Post');
  
	$title = apply_filters('the_title', $title, $post);
        $string = '<a href="'.get_permalink($post->ID).'">';  
	$link = str_replace('%title', $title, $link);
	$link = $string . $link . '</a>';  

	$format = str_replace('%link', $link, $format);
        if($wraptag != '') {
            $format = "<$wraptag>$format</$wraptag>";
        }
	echo $format;
}



Then instead of

code:
<li><?php next_post_link('Previous') ?></li>



You could use

code:
<?php next_post_link('%link','Previous',true,'','li') ?>



Use true above to make sure the links go to articles in the same category.

(Edited by Nathus on 03-27-2008 21:17)

SleepingWolf
Paranoid (IV) Inmate

From:
Insane since: Jul 2006

IP logged posted posted 03-27-2008 23:49 Edit Quote

Thanks Nathus
I'll take it for a spin offline (Xampp) and see if anything breaks.
Cheers

Nature & Travel Photography
Main Entrance

SleepingWolf
Paranoid (IV) Inmate

From:
Insane since: Jul 2006

IP logged posted posted 03-27-2008 23:56 Edit Quote

Looked at the code..not using the same version of WP as you.
Will have to go thru the code to identify the changes.
Will need to change the previous function as well, it exhibits the same behaviour.
Thanks again - this will be a weekend project - too tired tired right now.


Nature & Travel Photography
Main Entrance

Nathus
Bipolar (III) Inmate

From: Minnesota
Insane since: Aug 2003

IP logged posted posted 03-28-2008 19:33 Edit Quote

Oops, I updated the wrong function. I thought you were using next_post_link which is used on single pages to link to the next article.

After looking at your site, it appears that you just limited the number of posts visible per page to 1 which would use the next_posts_link function (which you stated, but I missed)

So, all you would need to do is update the next_posts_link function to the following

code:
function next_posts_link($label='Next Page &raquo;', $max_page=0, $wraptag='') {
	global $paged, $wpdb, $wp_query;
	if ( !$max_page ) {
		$max_page = $wp_query->max_num_pages;
	}
	if ( !$paged )
		$paged = 1;
	$nextpage = intval($paged) + 1;
	if ( (! is_single()) && (empty($paged) || $nextpage <= $max_page) ) {
               if($wraptag != '') {
                    echo "<$wraptag>";
               }
		echo '<a href="';
		next_posts($max_page);
		echo '">'. preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $label) .'</a>';
              
               if($wraptag != '') {
                    echo "</$wraptag>";
               }
	}
}



To use it in the template page, use the following code

code:
<?php next_posts_function('Previous',0,'li'); ?>



I am using 2.3.3 and it looks like you are using 2.2.2, but this should work as i looked at the code for the function in 2.2.2 and it is the same.

(Edited by Nathus on 03-28-2008 19:34)

(Edited by Nathus on 03-28-2008 19:34)

SleepingWolf
Paranoid (IV) Inmate

From:
Insane since: Jul 2006

IP logged posted posted 03-28-2008 23:07 Edit Quote

Thanks Nathus..very much appreciated.
I have to rebuild my site, so I will update to 2.3.3.
In fact I just spent 30 minutes figuring out how to remove the automatic updates without using a plugin.
Found the files to fix..no more nags..no more Wordpress trying to contact the mothership.

Thanks again!

edit: rereading your post, just wanted to specify that I only "limit the posts to one" in one category..in other words i'm using a new category with its own style to accommodate a larger picture - this becomes my wordpress photoblog. I'm also preventing that category from displaying on the front page as it would break the format.

Nature & Travel Photography
Main Entrance

(Edited by SleepingWolf on 03-29-2008 00:10)



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu