• Resolved Faramarz

    (@faramarz)


    Hi,

    I’ve created a ‘Speakers’ custom post type and I want to show a list of my speakers names hyperlinked to their single page. This is the loop I am using but I don’t know how/where to squeeze in the <a href="<?php the_permalink() ?> in it:

    <?php
    $args = array( 'post_type' => 'speakers', 'posts_per_page' => 100, 'orderby' => 'title', 'order' => 'ASC' );
    $loop = new WP_Query( $args );
    
    while ( $loop->have_posts() ) : $loop->the_post();
    
        echo '<div class="entry-content">';             
    
    	the_title();		
    
        echo '</div>';
    
    endwhile;
    ?>

    Any help would be appreciated.

    Thanks

Viewing 1 replies (of 1 total)
  • Thread Starter Faramarz

    (@faramarz)

    I got it:

    <?php
    $args = array( 'post_type' => 'speakers', 'posts_per_page' => 100, 'orderby' => 'title', 'order' => 'ASC' );
    $loop = new WP_Query( $args );
    
    while ( $loop->have_posts() ) : $loop->the_post();
    
        echo '<div class="entry-content">';             
    
    					echo '<a href="' . get_permalink() . '">';
    					the_title();
    					echo '</a>';	
    
        echo '</div>';
    
    endwhile;
    ?>
Viewing 1 replies (of 1 total)
  • The topic ‘Hyperlinking with the_permalink(); in custom post types’ is closed to new replies.