WordPress : Función the_permalink saca la URL de post actual del loop
Fecha Publicación:
05 de Septiembre de 2022
Fecha Modificación:
05 de Septiembre de 2022
Sintaxis:
the_permalink()
la Función the_permalink Esta función se debe usar dentro de los ciclos loop. No necesita el paso de parámetros, simplemente saca la URL de post actual del loop.
<?php
if ( have_posts( ) ){
if( is_home() ){
while ( have_posts( ) ){
the_post( );
<a href="<?php the_permalink(); ?>"
title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>
}
}
}
?>
De esta manera con el código anterior obtendríamos la url del post.
Articulo : 905 - Veces Leidas