438 posts
  • Has been part of the Envato Community for over 2 years
  • Has sold $5,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Located in Europe
+1 more
Pixelous says

echo get_page_template_slug( get_queried_object_id() );
to check if page template slug is correct BF

Thanks for your answer. Have pasted it in my template. At page-home.php it returns page-home.php, but for my templates like page-portfolio-4-columns-isotope.php it returns nothing. How could it be, is it a bug or what?

438 posts
  • Has been part of the Envato Community for over 2 years
  • Has sold $5,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Located in Europe
+1 more
Pixelous says

In these page templates I have 2 loops and after one of them I didn’t have this:

<?php wp_reset_query(); ?>

After I have added it everything works fine now. Thanks for everyone’s responses!

894 posts
  • Has sold $1,000+ on Envato Market
  • Has referred 1+ members
  • Has collected 10+ items on Envato Market
  • Has been part of the Envato Community for over 3 years
+5 more
infuse01 says

I remember I had a similar issue one time and it was caused by numbers in the file name. May try to rename the file to page-portfolio-two-columns-isotope.php.

438 posts
  • Has been part of the Envato Community for over 2 years
  • Has sold $5,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Located in Europe
+1 more
Pixelous says

I remember I had a similar issue one time and it was caused by numbers in the file name. May try to rename the file to page-portfolio-two-columns-isotope.php.

Have tried already but didn’t help, as I have said only this have helped:

<?php wp_reset_query(); ?>
3256 posts
  • Has referred 100+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+9 more
ParkerAndKent says

Did you assign the right page template to the pages you’re checking?

When you check the page template:

is_page_template(‘page-portfolio-2-columns-isotope.php’)

you must be sure that page-portfolio-2-columns-isotope.php is a page template and that it’s assigned to the page you’re checking.

I’m sure you did something wrong here, otherwise it’s impossible to have is_page_template() to fail… no bugs inWP, believe me :)

Parker

3266 posts
  • Has sold $5,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Located in United States
  • Has been part of the Envato Community for over 4 years
+1 more
organicbee says

no bugs inWP, believe me :)

oh theres bugs…. they’re mean little ** ;-)

3256 posts
  • Has referred 100+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+9 more
ParkerAndKent says


no bugs inWP, believe me :)
oh theres bugs…. they’re mean little ** ;-)

I meant no bugs with the is_page_template function :) WP has many bugs, I fight with them everyday :)

438 posts
  • Has been part of the Envato Community for over 2 years
  • Has sold $5,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Located in Europe
+1 more
Pixelous says

Did you assign the right page template to the pages you’re checking?

When you check the page template:

is_page_template(‘page-portfolio-2-columns-isotope.php’)

you must be sure that page-portfolio-2-columns-isotope.php is a page template and that it’s assigned to the page you’re checking.

I’m sure you did something wrong here, otherwise it’s impossible to have is_page_template() to fail… no bugs inWP, believe me :)

Parker

Yes, I have assigned the right page template to the pages I am checking. Ok, if u are thinking I have done something wrong, try this page template on your server http://pastebin.com/KTQ0dfqj then in your functions.php try this:

/**
 * Initialize jQuery Plugins.
 */
function index_initialize_jquery_plugins() {
<script>
jQuery(document).ready(function(){
<?php if ( is_page_template('page-portfolio-4-columns-isotope.php') ) : ?>
// script goes here... Do u see me?
<?php endif; ?>
});
    </script>
<?php
}
add_action( 'wp_footer', 'index_initialize_jquery_plugins' );

Then tell me please do u see this?

// script goes here... Do u see me?

at your front end under the footer? And one more is_page_template() doesn’t work within the loop. Due to certain global variables being overwritten during The Loop is_page() will not work. In order to use it after The Loop you must call wp_reset_query() after The Loop. http://codex.wordpress.org/Function_Reference/is_page_template

by
by
by
by
by
by