php - Difference between get_template_directory_uri() and upload images to wordpress site -


i'm working wordpress , want understand difference between uploading image in media folder on wordpress dashboard in media folder, , use get_template_directory_uri(); retrieve theme directory , display images have stored in image folder so:

<img src="<?php echo get_template_directory_uri();?>/img/image.png">

are there of these solution better other?

thank you

you should thinking in terms of is content / resources static or dynamic?

if resource part of theme (ie. static), best use:

<img src="<?php echo get_template_directory_uri();?>/img/image.png"> 

if part of content , can changed wordpress user, use media uploads. alternative use options framework allow user change static resources.


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -