Join my tribe!

Sign up to learn how to keep your skills up to date on the tech that matters most and confidently sell your skills to a growing customer base.
I will never spam you. You can unsubscribe at any time.

Reader Interactions


  1. Very nice tutorial for beginners Carrie.

    Easy to follow and understand.

    Here’s another version which i’ve modified slightly which is why i use Github Gists on my site.

    add_filter( ‘body_class’, ‘my_body_class’ );

    function my_body_class( $classes ) {

    if ( is_single() && is_author(‘Carrie’) ) {

    $classes[] = ‘giddyup’;
    return $classes;


    • Whoops! I missed that closing bracket – thanks for the heads up! I do like using gists on some of my longer snippets. I just feel kinda dorky using it for small samples like this post. Could definitely stand some better formatting, though. 🙂

      • Looks nicer without the Gist but when you copy and paste it, the apostrophes can change and cause errors after saving the file. Also if someone comes and republishes the code and there’s a small mistake, you can’t change it on their site unless its in your Gist.

  2. Hello Carrie

    Thanks for the new tutorial. I’ve learned a lot from your previous tutorials, I find them easy to understand. After I watched your tutorial, and Brian Gardner’s tutorial about widget areas

    I made a YouTube video about conditional tags. I’m not sure if you link to YouTube, if you do here’s the link. Your visitors might find it useful. Near the end of the video I included some slides explaining how it works.

    PS. Brad Dalton’s point about copying and pasting is important. It’s caught me out more than once.

  3. Hi Carrie,

    Not sure if this is the right place for this, but I wondered how create a testimonials widget like the one in your sidebar which (here’s the kicker) would randomly load a different testimonial each time the page reloads. I am going to create a testimonials CPT and can’t seem to get my head around how to approach a feature like this, though I *think* it would require some conditional coding…

    BTW I found your blog recently, and as a front-end designer taking the plunge into coding I must say that you really know how break down and explain things! Really helpful stuff all over. Thanks.

  4. Hi Carrie

    I am having problems with conditional code to move the navigation bar under the content on the Home page – yet keep the nav bar at the top of the page for all other pages. I can’t seem to get this to work, the bar remains at the top – I have tried using page number in the conditional statement for the home page, if (is_page( 5 ) but that doesn’t work either

    Using Genesis in the Custom Code Custom Functions section.

    This is my code:


    function move_navto_bottom () {
    if (is_front_page() ) {

    remove_action( 'genesis_before_header', 'genesis_do_nav' );
    add_action( 'genesis_after_content', 'genesis_do_nav' );

    Thanks for any ideas!

    • Carrie – figured it out:

      function move_navto_bottom() {
      if (is_front_page()) {
      /*move the nav bar below the content box*/
      remove_action(‘genesis_before_header’, ‘genesis_do_nav’);
      add_action(‘genesis_after_content’, ‘genesis_do_nav’);
      /*move the nav bar above the content box*/
      remove_action(‘genesis_before_header’, ‘genesis_do_nav’);
      add_action(‘genesis_before_content’, ‘genesis_do_nav’);

      add_action(‘genesis_before’, ‘move_navto_bottom’);


  5. Hi Carrie
    I have used you tutorials before and they are great thanks.
    This time I want to go a bit further I have a multi-site set up and want to change the background image on one of them I am using the executive pro theme and have the background image in .home-top you can view it at but as I say i would like a different image on I know I have to use a conditional in the functions file but that’s were I go cold any help would be greatly appreciated thanks in advance

    • Is this using backstretch or some other script to place the background or can you just define the background image using CSS?

      For instance, if it’s CSS, just target the specific page background using a body class unique to that page (if it doesn’t have a unique class already, you can add one by doing something like this).

      If you’re using a script you need to call conditionally, I’d recommend installing the Query Monitor plugin. It’ll show you which conditionals apply to the current page you’re on and you can take it from there…

  6. I would like to use a conditional tag for a advertisement category and then have an FTC disclosure appear only on those posts. The category ID is “ad” so the first part would be:

    is_category( $ad )

    How would you suggest I do the rest of it?

    • You’d want to wrap your conditional statement in a custom function, like:

      function your_function() {
      if ( is_category( 'ad' ) {
      // ftc disclosure

      And then hook your custom function to whatever action you want in the page. For instance:

      add_action ( 'genesis_after_entry', 'your_function');

      Check out the Genesis Visual Hook Guide plugin to see where different hooks are available on your page.

Leave a Reply