Proper way to use get_the_content() in front-page.php and the content-home.php?

To output your content, It is advised that you pass your content through a filter. get_the_content() does not do this, so it will not for example execute shortcodes or create <p> tags.

So, it would be better to use it this way:

<?php echo apply_filters( 'the_content', wp_trim_words( get_the_content() , 70 ) ); ?> 

You can also pass the $before and $after arguments to your title. This is a simple example of how to do so:

<?php the_title('<h1>', '</h1>'); ?>

Which will output this:

<h1>Your Title Here</h1>

It’s possible to pass variables or functions too. Take a look at this example:

<?php the_title('<h1><a href="'.get_the_permalink().'">','</a></h1>'); ?>

This will create a link of your title and wrap it in a header tag:

<h1><a href="https://wordpress.stackexchange.com/questions/274732/some path here">Your Title Here</a></h1>

You might want to take a look at this codex page for additional information about the_title_attribute() too.

Leave a Comment