Title: Executing PHP in before_loop
Last modified: August 22, 2016

---

# Executing PHP in before_loop

 *  [cyberinfinity](https://wordpress.org/support/users/cyberinfinity/)
 * (@cyberinfinity)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/executing-php-in-before_loop/)
 * 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/](https://wordpress.org/plugins/genesis-simple-hooks/)

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

 *  [Ron Rennick](https://wordpress.org/support/users/wpmuguru/)
 * (@wpmuguru)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/executing-php-in-before_loop/#post-5390413)
 * 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/](http://www.studiopress.com/forums/).
 *  Thread Starter [cyberinfinity](https://wordpress.org/support/users/cyberinfinity/)
 * (@cyberinfinity)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/executing-php-in-before_loop/#post-5390426)
 * 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.

 * ![](https://ps.w.org/genesis-simple-hooks/assets/icon-256x256.png?rev=1335659)
 * [Genesis Simple Hooks](https://wordpress.org/plugins/genesis-simple-hooks/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/genesis-simple-hooks/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/genesis-simple-hooks/)
 * [Active Topics](https://wordpress.org/support/plugin/genesis-simple-hooks/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/genesis-simple-hooks/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/genesis-simple-hooks/reviews/)

## Tags

 * [is_category](https://wordpress.org/support/topic-tag/is_category/)

 * 2 replies
 * 2 participants
 * Last reply from: [cyberinfinity](https://wordpress.org/support/users/cyberinfinity/)
 * Last activity: [11 years, 5 months ago](https://wordpress.org/support/topic/executing-php-in-before_loop/#post-5390426)
 * Status: not resolved