WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Page of custom post types not linking to posts (3 posts)

  1. eloise_effie
    Member
    Posted 11 months ago #

    Hi there

    Ive used the WordPress page of custom post types: http://codex.wordpress.org/Page_Templates#Example_Using_Custom_Fields

    It shows the posts on my page but doesn't link each post to the posts permalink

    Ive tried editing this part of the code:

    while ( $wp_query->have_posts() ) : $wp_query->the_post();
    		echo '<div id="blog-table">';
                    echo '<h2>';
    		the_title();
                    echo '</h2>';
                    echo '<div class="entry-content">';
                    the_content();
                    echo '</div>';
    		echo '</div>';
                endwhile;

    but if I put a link to the permalink in the "the_title();" part my entire page goes blank

    Can anybody help me edit this please?

    Thanks

  2. vtxyzzy
    Member
    Posted 11 months ago #

    Try replacing this:

    the_title();

    with this:

    echo '<a href="' . get_permalink( $post->ID ) . '" rel="bookmark" title="' . strip_tags(get_the_title()) . '">' . get_the_title() . '</a>';
  3. eloise_effie
    Member
    Posted 11 months ago #

    Worked perfectly :)

    Thank you

Reply

You must log in to post.

About this Topic