• I’m trying to put some text at the top of the page, only for one blog category, so I’ve added some PHP to the before_loop hook, but it’s not working. If I uncheck “execute PHP” I see the text on all pages (as one would expect), but when I check it, not only does my text not show up as intended, but even if I just add some test characters outside the PHP, they don’t show up if I’m telling it to execute PHP. Also if I add a really simple “hello world” sort of bit of PHP, that doesn’t work either.

    Here’s the code I’m using, what am I doing wrong?

    <?php
    if (is_category(‘Videos’) ) {
    <h1>Videos</H1>
    <P>(client) provides legal advice to our clients in a number of areas. The following videos will provide you with a brief overview of those areas of the law with some suggestions for your consideration prior to scheduling an appointment with the appropriate attorney in our firm.
    }
    ?>

    https://wordpress.org/plugins/genesis-simple-hooks/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Look at your Videos category and see what the slug is. Replace Videos in this line to the slug

    if (is_category('Videos') ) {

    Also, for site customization post a thread at http://www.studiopress.com/forums/.

    Thread Starter cyberinfinity

    (@cyberinfinity)

    The slug is ‘videos’ – it’s all lowercase, but that isn’t working either

    I don’t think it’s specifically my code that’s causing the problem, because even if I have some text outside the code, it doesn’t show up when I have “execute PHP” checked, nor does a straight-forward bit of PHP.

    Is there something that would be making the “execute PHP” not only not work, but break the whole thing?

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

The topic ‘Executing PHP in before_loop’ is closed to new replies.