334 posts
  • Has referred 10+ members
  • Has sold $10,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 50+ items on Envato Market
+4 more
cosmincotor says

Hi guys, I need to check if the current page is the “index.php” (I’m not talking about the home page – is_home(), I need to know if the current page is using the “index.php” file), similar to “is_page_template()” which doesn’t work in this case.

Any help would be appreciated, thank you! :)

2588 posts Put a Donk On It
  • Elite Author: Sold more than $75,000 on Envato Market
  • Sells items exclusively on Envato Market
  • Made it to the Authors' Hall of Fame
  • Has sold $250,000+ on Envato Market
+10 more
ThemeProvince says
if (basename(__FILE__) == "index.php") echo "barf";
334 posts
  • Has referred 10+ members
  • Has sold $10,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 50+ items on Envato Market
+4 more
cosmincotor says

Thanks ThemeProvince, but it doesn’t seem to work, here’s how I added it:

<?php if(is_page_template( 'page-home-1.php' ) || (basename(__FILE__) == "index.php" && $options['blogSlider'] == "blogNivo")){ ?>

I need to add some code, if the page is the “home template” or if the page is index.php and the option is set to “blogNivo”.

334 posts
  • Has referred 10+ members
  • Has sold $10,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 50+ items on Envato Market
+4 more
cosmincotor says

Just to clear things a little more, the code above works if i’m on the homepage, but I’m using the index.php as my blog page on another page (sort of like a template) the code fails.

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by