Error with get_permalink()
-
Hi there.
I’m getting an error with the get_permalink() code. I have this code to display the link of the page:
<?php /*global $query_string; query_posts( $query_string . '&order=ASC' );*/ $args = array('post_type' => 'page', 'posts_per_page' => '6', 'post__not_in'=>array('3491', '77','73','58') ); $loop = new WP_Query($args); while ($loop->have_posts()) : $loop->the_post(); $feat_image = wp_get_attachment_url(get_post_thumbnail_id($post->ID)); ?> <li class="col-lg-4 col-md-4 col-sm-6 col-xs-12 prod"> <img src="<?php echo $feat_image; ?>"> <div class="prod_hov col-lg-4 col-md-4 col-sm-6 col-xs-12"> <h1><a href="<?php the_field('link'); ?>"><?php the_title(); ?></a></h1> </div> <div class="prod_shad col-lg-4 col-md-4 col-sm-6 col-xs-12"> <h1><?php echo get_the_title(); ?></h1> <p><?php the_excerpt(); ?></p> <h2><a href="<?php echo get_permalink(); ?>">saber mais</h2> </div> </li> <?php endwhile; ?>
and the result displays this:
<li class="col-lg-4 col-md-4 col-sm-6 col-xs-12 prod"> <img src="https://localhost:8080/sites/bioportugal/wp-content/uploads/2016/01/ci--ncias-da-vida2.jpg"> <div class="prod_hov col-lg-4 col-md-4 col-sm-6 col-xs-12"> <h1><a href="">CIêNCIAS DE VIDA</a></h1> </div> <div class="prod_shad col-lg-4 col-md-4 col-sm-6 col-xs-12"> <h1>CIêNCIAS DE VIDA</h1> <p></p><p>Especialmente focados no utilizador de técnicas de Biologia Molecular.</p> <h2><a href="https://localhost:8080/sites/bioportugal/ciencias-de-vida/">saber mais</a></h2><a href="https://localhost:8080/sites/bioportugal/ciencias-de-vida/"> </a></div><a href="https://localhost:8080/sites/bioportugal/ciencias-de-vida/"> </a></li>
as you can see the permalink code is duplicating the “a” tag, is there any solution to this?
Thanks.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Error with get_permalink()’ is closed to new replies.