WordPress.org

Ready to get started?Download WordPress

Forums

Getting page name for blog, not home page (1 post)

  1. coolpillows
    Member
    Posted 1 year ago #

    I developed my site with a fine WP developer (if anyone's interested, lemme know), but he is out of town and I am still resolving one thing.

    I have a border image under the navigation tabs which is conditional for the navigation based on page.
    he's advising me to add

    At the top of the template file type '"echo $pagename;"'
    This should then output the name of the page as WP sees it.

    - - - - - here's links that display the border under the image properly - - - - -
    As in humor:

    There is a border under those tabs that SHOULD be under 'Blog' on

      but it is not appearing

      - - - - - here's the conditional statements for all 3 - - - - - - - -

      'if (is_home()){
      echo ('<img src="' . get_stylesheet_directory_uri() . '/img/blog_bar.jpg" alt="blog page border" />');
      }elseif ($pagename == "humor"){
      echo ('<img src="' . get_stylesheet_directory_uri() . '/img/humor_bar.jpg" alt="humor page border" />');
      }elseif ($pagename == "consulting"){
      echo ('<img src="' . get_stylesheet_directory_uri() . '/img/consulting_bar.jpg" alt="consulting page border" />');'

Topic Closed

This topic has been closed to new replies.

About this Topic