439 posts
  • Bought between 50 and 99 items
  • Europe
  • Exclusive Author
  • Has been a member for 2-3 years
  • Sold between 5 000 and 10 000 dollars
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?

439 posts
  • Bought between 50 and 99 items
  • Europe
  • Exclusive Author
  • Has been a member for 2-3 years
  • Sold between 5 000 and 10 000 dollars
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
  • Europe
  • Has been a member for 3-4 years
  • Exclusive Author
  • Sold between 1 000 and 5 000 dollars
  • Bought between 10 and 49 items
  • Referred between 1 and 9 users
  • Most Wanted Bounty Winner
  • Envato Studio (Microlancer) Beta Tester
  • Grew a moustache for the Envato Movember competition
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.

439 posts
  • Bought between 50 and 99 items
  • Europe
  • Exclusive Author
  • Has been a member for 2-3 years
  • Sold between 5 000 and 10 000 dollars
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
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Exclusive Author
  • Interviewed on the Envato Notes blog
  • Beta Tester
  • Author had a File in an Envato Bundle
  • Author had a Free File of the Month
+4 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

3192 posts
  • Sold between 5 000 and 10 000 dollars
  • United States
  • Bought between 10 and 49 items
  • Has been a member for 4-5 years
  • Exclusive Author
organicbee says

no bugs inWP, believe me :)

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

3256 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Exclusive Author
  • Interviewed on the Envato Notes blog
  • Beta Tester
  • Author had a File in an Envato Bundle
  • Author had a Free File of the Month
+4 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 :)

439 posts
  • Bought between 50 and 99 items
  • Europe
  • Exclusive Author
  • Has been a member for 2-3 years
  • Sold between 5 000 and 10 000 dollars
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