• This piece of code displays a message in the middle of my front home page(functions.php):

    /** Add the page title section */
    add_action( 'genesis_after_header', 'minimum_page_title' );
    function minimum_page_title() {
    	require_once( get_stylesheet_directory() . '/page-title.php' );
    }

    Problem is that all other non-home pages are also displaying the same message above post titles. I would like to do something like this:

    /** Add the page title section */
    if ( is_home() ){
    add_action( 'genesis_after_header', 'minimum_page_title' );
    }
    else {
    add_action( 'genesis_after_content', 'minimum_page_title' );
    }
    
    function minimum_page_title() {
    	require_once( get_stylesheet_directory() . '/page-title.php' );
    }

    But this does not work. Can someone suggest an alternative way of properly coding it?

    Many thanks in advance

Viewing 3 replies - 1 through 3 (of 3 total)
  • I’m sorry but as you are using a commercial framework, you need to seek support from the theme’s developer/vendor. We do not support commercial products here.
    http://www.studiopress.com/support

    Thread Starter sf49ers

    (@sf49ers)

    @esmi-

    thank you for the reply. but my question also applies to non-commercial wordpress functions.php? i posted that sample because that had a clear example of what i was looking for.

    how about if i re-word it this way:

    can either of two different add_action hooks be executed, depending on an “if…else” conditional statement? if yes, how?

    The code above is from a commercial framework. Do you have an example from a theme downloaded from http://wordpress.org/extend/themes/ ?

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

The topic ‘How to execute conditional statement for add_action’ is closed to new replies.