WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am building a custom page for portfolio. It will require additional css and jss file for the navigation slider... Since that part is contained in the header.php I decided to take the part I need and hoped it would accept my tags for the external files. Though the link can be seen in the page's head tag, they are not being called. I have looked extensively and all the suggestions points to using wp_enqueue_script() and wp_enqueue_style() which is an overkill. Even trying them does not help and I would like to call the external links only if someone visits the portfolio page and not burden the rest of the site. I will appreciate some insight. www.gransar.net/portfolio

share|improve this question
wp_register_script( $handle, $src, $deps, $ver, $in_footer );
wp_register_style( $handle, $src, $deps, $ver, $media );

if (!is_admin()) {
add_action('wp_enqueue_scripts', 'my_js'); // for js
add_action('wp_enqueue_scripts','my_style'); // for css
function my_js(){
 if(is_page(page id)){ // or is_page_template(page slug)
    wp_register_script( 'port-js', get_template_directory_uri() . '/portfolio-js.js');
    wp_enqueue_script( 'port-js ');
function my_style(){
 if(is_page(page id)){ // or is_page_template(page slug)
        wp_register_style( 'port-style', get_template_directory_uri() . '/portfolio-style.css');
        wp_enqueue_style( 'port-style' );

Use is_page or is page_template to load script and style only page.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.