• Hi all.
    I’m using the Twenty Seventeen theme to learn more about WordPress development, so please bear with my nooby question.

    I know that in the link post format, the first a href tag is used as the external link for that post.

    However, I’ve spent hours looking through the template files and couldn’t find the functions which determine that.

    Here’s the loop:

    if ( have_posts() ) :
    				while ( have_posts() ) :
    					the_post();
    					get_template_part( 'template-parts/post/content', get_post_format() );

    Since there’s no content-link.php file in the template-parts folder, the catchall content.php file will be used instead.

    But here’s the codes for generating the post title and its link:

    if ( is_single() ) {
    			the_title( '<h1 class="entry-title">', '</h1>' );
    		} elseif ( is_front_page() && is_home() ) {
    			the_title( '<h3 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h3>' );
    		} else {
    			the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' );
    		}

    This code simply outputs the post title and the permalink of the current post. So, if the current post is link post format, how does WordPress set the external link provided in the post content as the hyperlink for the post?

    I must be overlooking something, but I can’t find it.

    • This topic was modified 5 years, 4 months ago by komonodesign.
    • This topic was modified 5 years, 4 months ago by komonodesign.
    • This topic was modified 5 years, 4 months ago by komonodesign.
    • This topic was modified 5 years, 4 months ago by komonodesign.
Viewing 1 replies (of 1 total)
  • I know that in the link post format, the first a href tag is used as the external link for that post.

    It is? I don’t see that at all.
    The code does say it supports the link post format, but there is no code in the theme that does anything special with it.

Viewing 1 replies (of 1 total)
  • The topic ‘Post Link Format—What Functions Determine The External Link’ is closed to new replies.