• Hello,
    I am writing a plugin, and I want to check whether the home page is being shown.
    I tried is_home() function within my plugin but that function doesnt return anything.
    Can anybody please tell me how I can check if the home page is displayed?

    cheers
    M.

Viewing 4 replies - 1 through 4 (of 4 total)
  • CodePoet

    (@design_dolphin)

    Does is_front_page() work?

    Thread Starter meereck

    (@meereck)

    it doesnt work either.:(
    any clues how to find out if the front page is being displayed?
    cheers

    Thread Starter meereck

    (@meereck)

    i did some testing, and wordpress behaves rather weird:
    Here is my theme/index.php

    get_header(); ?>
    <div id="data">
    <?php echo "home:". is_home();?>
    <?php
    if(is_home())
    {
      query_posts('category_name=Main');
      if (have_posts()) : while (have_posts()) : the_post(); ?>
      <div class="item">
      <h2 class="item"><?php the_title(); ?> (<?php echo the_time("j.n.Y H:i");?>)</h2>
      <?php
      the_content();?>
      </div>
      <?php
      endwhile; endif;
    }
    ?>
    <?php echo "home:". is_home();?>
    </div>
    <?php get_footer(); ?>

    When showing the front page, the first occurence of is_home() returns 1 whereas the second one returns nothing.
    Can anybody tell me what I am doing wrong?
    thanks

    Thread Starter meereck

    (@meereck)

    The thing is I want to use is_home function in the footer, and it never works there.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘WP Plugin: is_home function’ is closed to new replies.