ThemeShaper Forums » Power Blog

Variable/selector needed

(4 posts)
  1. Don’t even know if this is called a variable or selector. But anyhow, i would like something like this:

    If this is the “homepage” then display “code-1",
    but if this is a “page” then display nothing,
    but if this is a “category view” or “single post” then display “code-2”.

    This should display right below the menu div (like the black “leader-div” on http://themeshaper.com/blog/).

    Example:
    “Homepage” leader-div should read like “Welcome to XYZ, where you will find ABC and 123”.
    “Category view” and “post“ leader-div should read like “You are viewing the EXTRAS, a service from XYZ”.

    Posted 10 years ago #
  2. Let me know if this works for you:

    function displayCode()
    {
        $output = '<div id="leader-div">';
        if( is_front_page() )
        {
            $output .= 'Welcome to XYZ, where you will find ABC and 123';
        }
        elseif( is_category() || is_single() )
        {
            $output .= 'You are viewing the EXTRAS, a service from XYZ';
        }
        $output .= '</div>';
        if( is_page() )
        {
            $output = '';
        }
        echo $output;
    }
    add_action('thematic_belowheader','displayCode');
    Posted 10 years ago #
  3. Hi,

    would change it a bit otherwise the '<div id="leader-div"></div>' will be created on search and all archive pages:

    function displayCode()
    {
        if( is_front_page() )
        {
            $output = '<div id="leader-div">';
            $output .= 'Welcome to XYZ, where you will find ABC and 123';
            $output .= '</div>';
            echo $output;
        }
        elseif( is_category() || is_single() )
        {
            $output = '<div id="leader-div">';
            $output .= 'You are viewing the EXTRAS, a service from XYZ';
            $output .= '</div>';
            echo $output;
        }
    }
    add_action('thematic_belowheader','displayCode');

    Chris

    Posted 10 years ago #
  4. Wow, thanks to the both of you! This is exactly what i was looking for!

    Posted 10 years ago #

RSS feed for this topic

Reply

You must log in to post.