Skip to content
Advertisement

wordpress template_directory in a link – php

In wordpress I try to work with the given syntax template_directory() for links.

If I use the full path from root directory it works.

$ptthlider_img_second = '/wp/wp-content/themes/theme_name/inc/img/front_slider/slide2.jpg';

My wished goal is to use template_directory for accessing the jpg.

$ptthlider_img_first = template_directory() . '/inc/img/front_slider/slide1.jpg';

Do you have any conclusions to assist me here?

Thanks and best regards, Dennis

Advertisement

Answer

use get_template_directory() get_template_directory documentation

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement