Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Conditional PHP includes on WordPress

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #28959
    gofstawerks
    Member

    So I was trying to use conditional php includes to customize an existing WordPress Template I just bought.
    I know nothing about PHP, however I’ve been trying to search and find answers as a go along. Something that I have not been able to figure out is how to do a conditional PHP Include. Everytime I try, I get a blank white page :? . Heres what I tried and my source.
    The source code from – http://codex.wordpress.org/Category_Templates

    Code:

    This is the text to describe category A

    This is the text to describe category B

    This is some generic text to describe all other category pages,
    I could be left blank

    what I turned it into

    Code:

    ID); ?>


    Thanks in advance and sorry if it is a stupid question :oops: .

    #75509
    Tcooper
    Member

    Because what you are trying to do is all php you don’t need to keep switching in and out:

    Code:
    ID);
    }else{
    include(‘someotherfile.php’);
    }
    ?>

    Although, I don’t think it would actually stop it from working – the syntax is still correct in what you have done. The other reasons it might not work are as follows:

      is_category function doesn’t exist
      get_video function doesn’t exist
      someotherfile.php doesn’t exist
      [/list:u]

      Of course, it also won’t include if is_category(‘somecategory’) returns true :P

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Back End’ is closed to new topics and replies.