Possible broken links in archive.php - wordpress

Good day,

I used php based WordPress for the blog page of my site http://prygara.com/blog/ and some links are not working. When you go to Post Categories on the left and then Posted In link or if you just go into a single post and then Categorized As link, I am getting Error 404 - Not Found.

Here’s the original discussion on this:

http://www.sitepoint.com/forums/showthread.php?1161388-sticky-footer-layout-breaks-on-blog-page&p=5583625#post5583625

I don’t know PHP language and tried posting in WordPress forum but did not get much response

Appreciate any help. Thanks.

Your hyperlinks are screwed up. This is what it looks like:


[COLOR="#0000CD"]<a class="page" href="[/COLOR]<a href="http://prygara.com/blog/category/html-css/" title="View all posts in HTML/CSS" rel="category tag">HTML/CSS</a>

Somewhere in your template files there is an extraneous starting <a> tag fragment.

<a class="page" href="

I can’t tell you where it is because I don’t know what you have done to your theme. Which template files did you modify?

It could be located in your template’s index.php file or maybe /wp-includes/category-template.php file. There is now way for me to know.

Hi cheesedude, thanks for the quick response. This line of code you are referring to is located in archive.php. Here’s the archive.php code fragment - line 3, right after “Posted in”:

<p>
<?php the_tags(__('Tags:', 'kubrick'), ', ', '<br />'); ?> 

<span class="postmeta"><?php printf(__('Posted in <a class="page" href="%s', 'kubrick'), get_the_category_list(', ')); ?> | 
						
<?php edit_post_link(__('Edit', 'kubrick'), '', ' | '); ?>
						
<a class="page" href="<?php comments_popup_link(__('No Comments »', 'kubrick'), __('1 Comment »', 'kubrick'), __('% Comments »', 'kubrick'), '', __('Comments Closed', 'kubrick') ); ?></a>
</span>
</p>

I also have this code in index.php

<h2><a class="page" href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>

Please, let me know if you need more info.

I was in the process of replying 16 hours ago when I got pulled away.

Looking again at your HTML, it looks like you have made some changes? This is what your HTML output looks like now:

<span class="postmeta">Posted in 						
<a class="page" href="<a href="http://prygara.com/blog/category/html-css/" title="View all posts in HTML/CSS" rel="category tag">HTML/CSS</a> |
						
<a class="page" href="<a href="http://prygara.com/blog/2013/08/03/htmlcss-test-post-2/#respond" title="Comment on HTML/CSS test post # 2">No Comments »</a></a></span>

I don’t know what your PHP code looks like now, but the problem looks like it lies in this line (depending on how and if it was changed):

<span class="postmeta"><?php printf(__('Posted in <a class="page" [U]href="%s[/U]', 'kubrick'), get_the_category_list(', ')); ?> |  

You see the

href="%s

part underlined above? I believe (but I am not sure) there should be a closing double quote mark like this:

<span class="postmeta"><?php printf(__('Posted in <a class="page" [U]href="%s"[/U]', 'kubrick'), get_the_category_list(', ')); ?> |  

Please try it that way, test it, then report back. And when you report back, please paste in an example of your current version of code.

hi cheesedude,

I tried a closing double quote mark like this

href="%s"

and unfortunately it doesn’t work.

Here’s the code for archive.php

<?php get_header();?>

<?php get_sidebar(); ?>


	<div id="rightcol" role="main">

		<?php if (have_posts()) : ?>

 	  <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
 	  <?php /* If this is a category archive */ if (is_category()) { ?>
		<?php printf(__(''), single_cat_title('', false)); ?>
 	  <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
		<h2 class="link"><?php printf(__('Posts Tagged ‘%s’', 'kubrick'), single_tag_title('', false) ); ?></h2>
 	  <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
		<h2 class="pagetitle"><?php printf(_c('Archive for %s|Daily archive page', 'kubrick'), get_the_time(__('F jS, Y', 'kubrick'))); ?></h2>
 	  <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
		<?php printf(_c(''), get_the_time(__('F, Y', 'kubrick'))); ?>
 	  <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
		<h2 class="pagetitle"><?php printf(_c('Archive for %s|Yearly archive page', 'kubrick'), get_the_time(__('Y', 'kubrick'))); ?></h2>
	  <?php /* If this is an author archive */ } elseif (is_author()) { ?>
		<h2 class="pagetitle"><?php _e('Author Archive', 'kubrick'); ?></h2>
 	  <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
		<h2 class="pagetitle"><?php _e('Blog Archives', 'kubrick'); ?></h2>
 	  <?php } ?>


		<div class="navigation">
			<div class="alignleft"><?php next_posts_link(__('&laquo; Older Entries', 'kubrick')); ?></div>
			<div class="alignright"><?php previous_posts_link(__('Newer Entries &raquo;', 'kubrick')); ?></div>
		</div>

		<?php while (have_posts()) : the_post(); ?>
		<div <?php post_class(); ?>>
				<h2 id="post-<?php the_ID(); ?>"><a class="page" href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s', 'kubrick'), the_title_attribute('echo=0')); ?>"><?php the_title(); ?></a></h2>
				<p class="date"><?php the_time(__('F j, Y', 'kubrick')) ?></p>

				<div class="entry">
					<?php the_excerpt() ?>
				</div>

				<p>
				   <?php the_tags(__('Tags:', 'kubrick'), ', ', '<br />'); ?>
					<span class="postmeta"><?php printf(__('Posted in
						
					   <a class="page" href="%s"', 'kubrick'), get_the_category_list(', ')); ?> |
						
					   <?php edit_post_link(__('Edit', 'kubrick'), '', ' | '); ?>
						
					   <a class="page" href="<?php comments_popup_link(__('No Comments »', 'kubrick'), __('1 Comment »', 'kubrick'), __('% Comments »', 'kubrick'), '', __('Comments Closed', 'kubrick') ); ?></a>
					</span>
				</p>

			</div>

		<?php endwhile; ?>

		<div class="navigation">
			<div class="alignleft"><?php next_posts_link(__('&laquo; Older Entries', 'kubrick')); ?></div>
			<div class="alignright"><?php previous_posts_link(__('Newer Entries &raquo;', 'kubrick')); ?></div>
		</div>
	<?php else :

		if ( is_category() ) { // If this is a category archive
			printf("<h2 class='center'>".__("Sorry, but there aren't any posts in the %s category yet.", 'kubrick').'</h2>', single_cat_title('',false));
		} else if ( is_date() ) { // If this is a date archive
			echo('<h2>'.__("Sorry, but there aren't any posts with this date.", 'kubrick').'</h2>');
		} else if ( is_author() ) { // If this is a category archive
			$userdata = get_userdatabylogin(get_query_var('author_name'));
			printf("<h2 class='center'>".__("Sorry, but there aren't any posts by %s yet.", 'kubrick')."</h2>", $userdata->display_name);
		} else {
			echo("<h2 class='center'>".__('No posts found.', 'kubrick').'</h2>');
		}
	  get_search_form();
	endif;?>
	
	</div>



<?php get_footer(); ?>

I am still struggling with PHP part of my blog page

http://www.sitepoint.com/forums/showthread.php?1175396-possible-broken-links-in-archive-php-wordpress&highlight=

Not sure if you can recommend any other places on the web where this question can be answered.