WordPress.org

Ready to get started?Download WordPress

Forums

Show PHP Code Only On Homepage (2 posts)

  1. adamgoldco
    Member
    Posted 1 year ago #

    I have some PHP code being generated by a plugin and I would like this code only to be run on the homepage. I.E. When I click on the "Older Posts" link I would like the plugin to NOT appear.

    As usual I've gone through the codex and searched google and none of the solutions I have found have worked for me.

    Here is the generated code:

    <?php
    if( function_exists('FA_display_slider') ){
        FA_display_slider(53);
    }
    ?>

    Here is one of the solutions I have tried with no avail:

    <?php if (is_home()) {
    ?>
    <?php
    if( function_exists('FA_display_slider') ){
        FA_display_slider(53);
    }
    ?>
    <?php
    }
    ?>

    Does anyone have any idea how I could get this working correctly?

    Thanks in advance!

  2. vtxyzzy
    Member
    Posted 1 year ago #

    If your site uses a static front page, try changing 'is_home()' to 'is_front_page()'.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags