• Asbjoern

    (@asbjoern_skoedt)


    Hi!

    There seem to be a problem with tag and category pages showing posts, but clicking the titles of the posts no longer link to the posts but instead it just links to the same category page. It loops to the same page.

    Please check out https://www.bykultur.dk/tag/bevaring and try clicking the post titles. URL is redirected to same page.

    How do I fix this?

    Kind regards Asbjoern

Viewing 9 replies - 1 through 9 (of 9 total)
  • the link href is empty in those post links;
    example:
    <h2><a href="" title="Ny udgivelse: MIN HISTORISKE HAVN">Ny udgivelse: MIN HISTORISKE HAVN</a></h2>

    have you edited the archive.php template of your theme in any way?

    generally, you will need to contact the developer of your theme for help; https://themeforest.net/item/adapt-a-responsive-wordpress-theme/2564586/support

    +1 to Michael, the title link is empty, tested with Chrome,
    By the way nice clean theme with nice typography,

    Thread Starter Asbjoern

    (@asbjoern_skoedt)

    Thanks a lot for the replies!

    I have not edited the archives.php and have not had installed new plugins since release of the website.

    I am afraid that the developer of the theme might not be supporting any longer, but I have written them.

    I think the problem might be the second line of code in the archives.php, which does not have “the_post();”. But changing does not seem to correct the mistake. Below is entire archives.php:

    <?php get_header(); ?>
    
    <?php if ( have_posts() ) : ?>
    
    	<header id="page-heading">
    		<h1><?php
    			if ( is_day() ) :
    				printf( __( 'Daily Archives: %s', 'wpex' ), get_the_date() );
    			elseif ( is_month() ) :
    				printf( __( 'Monthly Archives: %s', 'wpex' ), get_the_date( _x( 'F Y', 'monthly archives date format', 'wpex' ) ) );
    			elseif ( is_year() ) :
    				printf( __( 'Yearly Archives: %s', 'wpex' ), get_the_date( _x( 'Y', 'yearly archives date format', 'wpex' ) ) );
    			else :
    				echo single_term_title();
    			endif;
    		?></h1>
    	</header><!-- /page-heading -->
    
    	<div id="post" class="post clearfix">
    		<?php while( have_posts() ) : the_post() ?>
    			<?php get_template_part( 'content', get_post_format() ) ?>
    		<?php endwhile; ?>
    		<?php wpex_pagination(); ?>
    	</div><!-- /post -->
    
    <?php endif; ?>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    It’s a variation of Twenty 13 or 14 i think,

    Please post your inc/contents.php or so, if you copied and pasted it, i’m afraid you’ll have to rewrite archives and a few other loop pages.

    Thread Starter Asbjoern

    (@asbjoern_skoedt)

    Ok, here you go:

    <?php
    /******************************************************
     * Single Posts
     * @since 2.0
    *****************************************************/
    
    if ( is_singular() && is_main_query() ) { ?>
    
    	<?php if( has_post_thumbnail() ) { ?>
    		<img src="<?php echo aq_resize( wp_get_attachment_url( get_post_thumbnail_id() ), wpex_img('blog_post_width'),  wpex_img('blog_post_height'),  wpex_img('blog_post_crop') ); ?>" alt="<?php the_title(); ?>" class="post-thumbnail" />
    	<?php } ?>		
    
    <?php
    /******************************************************
     * Entries
     * @since 2.0
    *****************************************************/
    } else { ?>
    
    	<article class="loop-entry clearfix">
    
    		<h2><a href="<?php the_permalink(' ') ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
    		<?php if ( get_post_type() != 'page' || get_post_type() != 'portfolio') { ?>
    		<ul class="loop-entry-meta">
    			<li class="loop-entry-meta-date"><i class="fa fa-clock-o"></i><?php _e('D.','wpex'); ?> <?php the_time('j'); ?> <?php the_time('M'); ?>, <?php the_time('Y'); ?></li>
    			<li class="loop-entry-meta-author"><i class="fa fa-user"></i><?php _e('Skrevet af', 'wpex'); ?> <?php the_author_posts_link(); ?></li>
                <?php if( comments_open() ) { ?>
    				<li class="loop-entry-meta-comments"><i class="fa fa-comments"></i><?php _e('Med', 'wpex'); ?>  <?php comments_popup_link('0 kommentarer', '1 kommentar', '% kommentarer'); ?></li>
                <?php } ?>
    		</ul><!-- /loop-entry-meta -->
    		<?php } ?>
            <?php if ( wpex_get_data( 'blog_exceprt', '1' ) == '1' ) { ?>
    			<?php wpex_excerpt('30'); ?>
            <?php } else { ?>
            	<?php the_content(); ?>
            <?php } ?>
    	</article><!-- loop-entry -->
    
    <?php } ?>
    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    Side note to @altafhpatel (and totally unrelated to this topic): Thanks for helping but please stop trying to promote your site.

    Helping here is very cool, but using these forums to post comments and signatures about your website is considered spamming and isn’t permitted here.

    https://codex.www.ads-software.com/Function_Reference/the_permalink

    the_permalink() does not take a parameter (according to the Codex) however, as your theme adds this empty string ' ' this might somehow interfere;

    try to change that line to:

    <h2><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
    Thread Starter Asbjoern

    (@asbjoern_skoedt)

    Ok Michael. You beat the problem. The interference was indeed that empty string.

    Thank you a lot.

    please leave a note about this with the theme’s developer so they can fix the problem in future updates.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Links to Posts Not Working in Tag and Category Pages’ is closed to new replies.