wordpress get page url code example

Example 1: get templete uri

<img src="<?php echo get_template_directory_uri(); ?>/images/logo.png" width="" height="" alt="" />

Example 2: wordpress get template url

// Get template directory example:
<img src="<?php echo get_template_directory_uri(); ?>/images/logo.png" />

// If you use child theme you will have to use another function:
<img src="<?php echo get_stylesheet_directory_uri(); ?>/images/logo.png" />

Example 3: get wordpress page link by id

echo get_page_link($page_id);

Example 4: current url wordpress

global $wp;
echo home_url( $wp->request )

Example 5: wordpress get link

<a href="<?php the_permalink(); ?>">

Tags:

Html Example