Skip to:
Content
Pages
Categories
Search
Top
Bottom

Display only if is_front ?


  • Thion
    Member

    @thion

    In bbPress there’s a function “<?php bb_location(); ?>” – can this be used to create something like this:

    if ( current page is front page only ) :
    echo "something";
    endif;

    I need to display welcoming box only on my front page, but I don’t really understand what this how to use bb_location() for this (if this is possible at all)

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

  • _ck_
    Participant

    @_ck_

    There already is a function is_front()

    if (is_front()) {
    // do stuff
    }

    lots of related functions in template-functions.php

    if you need multiple pages, a trick I like to use is

    if (in_array(bb_get_location(),array('topic-page','tag-page','forum-page'))) {
    // do stuff
    }


    Thion
    Member

    @thion

    Hmm – documentation is really needed… :)


    _ck_
    Participant

    @_ck_

    Your best bet is to study other plugins.


    Thion
    Member

    @thion

    That’s how I’m writing Static Pages plugin now ;).

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

You must be logged in to reply to this topic.