get_template_directory_uri
-
<?php echo esc_url( get_template_directory_uri() ); ?>
not returning proper value or i’m just doing something wrong!I installed a menu and realized later that it doesn’t work on the portfolio and testimonial pages. It works everywhere else just not there.
I’ve played with various ways to reference the css and js files but it seems that
<?php echo esc_url( get_template_directory_uri() ); ?>
returns different values than expected.they way I have it now is
<link rel="stylesheet" type="text/css" href="wp-content/menu_files/swimbi-b.css"/>
tis works on all pages except testimonial and portfolio pages…i’ve tried
<link rel="stylesheet" type="text/css" href="<?php echo esc_url( get_template_directory_uri() ); ?>/menu_files/swimbi-b.css"/>
and this also works on most pages except testimonials and portfolio pages.I’ve looked and the code generated by the php and it seems that testimonial and portfolio pages handle <?php echo esc_url( get_template_directory_uri() ); ?> differently than other pages.
on testimonial pages the url changes to:
https://1weddingdj.com/testimonial/wp-content/menu_files/swimbi.css
and same for portfolio pages:
https://1weddingdj.com/portfolio/wp-content/menu_files/swimbi.csson all other pages it’s :
https://1weddingdj.com/wp-content/menu_files/swimbi.cssmy temp solution is to create directories on root with those files…
- The topic ‘get_template_directory_uri’ is closed to new replies.