home_url()
Useful for a link to the home directory.
<a title='Home' href='<?php echo home_url(); ?>'>Home</a>
get_stylesheet_directory()
Useful for using images in the stylesheet directory. NB use echo.
<img src="<?php echo get_stylesheet_directory_uri();?>/img/logo.jpg" />
get_permalink($post_id);
Gets the URL to a page from its ID.
echo get_permalink(2);
// echos http://localhost.sites/worth/about
get_page_by_path( 'about' );
Grabs the page or posts id, using only its slug. Useful when you don't know what the page's id is and you need a permalink. You can pass it to the above permalink function as an argument.
echo get_page_by_path( 'about' );
// echos 2
echo get_permalink( get_page_by_path( 'about' ) );
// echos http://localhost.sites/worth/about
get_term_link( $term_name, $taxonomy );
Gets the page link for the term archive of a certain taxonomy.
echo get_term_link( 'cute', 'tags' );
// First, set an action to trigger when Wordpress starts
add_action( 'init', 'MS_image_sizes' );
// In that action, add the image sizes
function MS_image_sizes(){
// add_image_size( $name, $width, $height, $crop );
add_image_size( 'magazine-thumb', 87, 115, true );
}
Next up we can recover the size of thumbnail using the the_post_thumbnail();
the_post_thumbnail('magazine-thumb');