Support » Fixing WordPress » Conditional page title for home verses other

  • Resolved rhonorginal

    (@rhonorginal)


    Hello

    I’m trying to create a conditional page title.

    For home, it would display the blog name, for anything else, the post/cat name plus blog name.

    This is as far as i’ve got. Can this all be within the <title> instead of having two?

    <?php $subs = get_categories('parent=9');
    $sub_ids = array();
    if( $subs ) foreach( $subs as $sub ) { $sub_ids[] = $sub->term_id; }
    if( is_single() && in_category( $sub_ids ) ) : ?>
    <title><?php bloginfo('name'); ?></title>
    <?php else : ?>
    <title><?php wp_title(''); ?> — <?php bloginfo('name'); ?></title>
    <?php endif; ?>
Viewing 12 replies - 1 through 12 (of 12 total)
Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Conditional page title for home verses other’ is closed to new replies.