WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Page of custom post types not linking to posts

[Resolved] Page of custom post types not linking to posts

  • 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

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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>';

    Worked perfectly 🙂

    Thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Page of custom post types not linking to posts’ is closed to new replies.
Skip to toolbar