Skip to content

Instantly share code, notes, and snippets.

@someguy9
Last active July 18, 2022 18:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save someguy9/51764538dd229742c6992f02940718fc to your computer and use it in GitHub Desktop.
Save someguy9/51764538dd229742c6992f02940718fc to your computer and use it in GitHub Desktop.
<?php
// Display post title using post ID
echo get_the_title( 5 );
// Display post title and safely escape value
echo esc_html( get_the_title() );
// Using the_title function to automatically echo the title, while you can append or prepend the title using the function as displayed below
the_title( 'Before:', ' - After' )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment