• I have a regular 2014 theme and I’ve modified my header to output an H1 title,
    I’ve done this through the_title but using it in the archive.php outputs first post title;

    using wp_title for archives has 2 problems:
    1.it adds blog-title to the archive title
    2.and also I can’t find a way of outputting the translation with qtranslate

    here’s my header:

    <?php
    
    /**
     * The Header for our theme
     *
     * Displays all of the <head> section and everything up till <div id="main">
     *
     * @package WordPress
     * @subpackage Twenty_Fourteen
     * @since Twenty Fourteen 1.0
     */
    ?><!DOCTYPE html>
    <!--[if IE 7]>
    <html class="ie ie7" <?php language_attributes(); ?>>
    <![endif]-->
    <!--[if IE 8]>
    <html class="ie ie8" <?php language_attributes(); ?>>
    <![endif]-->
    <!--[if !(IE 7) | !(IE 8) ]><!-->
    <html <?php language_attributes(); ?>>
    <!--<![endif]-->
    <head>
    	<meta charset="<?php bloginfo( 'charset' ); ?>">
    	<meta name="viewport" content="width=device-width">
    	<title><?php wp_title( '|', true, 'right' ); ?></title>
    	<link rel="profile" href="http://gmpg.org/xfn/11">
    	<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
    	<!--[if lt IE 9]>
    	<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js"></script>
    	<![endif]-->
    	<?php wp_head(); ?>
        <link href='http://fonts.googleapis.com/css?family=Droid+Serif|Oswald' rel='stylesheet' type='text/css'>
    </head>
    
    <body <?php body_class(); ?>>
    <div id="page" class="hfeed site">
    
        <!--[if lt IE 9]>
        <div class="update-browser" >
            <p>this website isn't made for old browsersand the one you're using is obsolete. <a href="http://
        browsehappy.com/">Upgrade your browser today </p></div>
        <![endif]-->
    
    	<?php if ( get_header_image() ) : ?>
    	<div id="head-area" class="full">
    	<div id="site-header">
    		<div id="wrap-head-img">
    		<a>" rel="home">
    			<img src="<?php header_image(); ?>" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="">
    		</a>
    	</div> <!-- wrap-head-img -->
    	<?php endif; ?>
    	<div id="flag-lang">
    				<?php echo qtrans_generateLanguageSelectCode('image'); ?>
    				</div>	
    
    	</div><!-- #site-header-->
    
    	<header id="masthead" class="site-header" role="banner">
    		<div class="header-main">
    			<h1 class="site-title"><a>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
    
    <nav id="primary-navigation" class="site-navigation primary-navigation" role="navigation">
    				<button class="menu-toggle"><?php _e( 'Primary Menu', 'twentyfourteen' ); ?></button>
    				<a href="#content"><?php _e( 'Skip to content', 'twentyfourteen' ); ?></a>
    				<?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?>
    			</nav>
    
    	<div class="search-wrap">
    		<div class="search-toggle">
    				<a href="#search-container"><?php _e( 'Search', 'twentyfourteen' ); ?></a>
    		</div>
    		<div id="search-container" class="search-box-wrapper hide">
    			<div class="search-box">
    				<?php get_search_form(); ?>
    			</div>
    		</div>
    
    		</div><!-- search-wrap -->
    
    		</div> <!--header-main-->
    
    	</header><!-- #masthead -->
    	</div><!-- #head-area-->
    
    	<div id="wrap-featured-rev">
    	<?php 	if ( is_front_page() ) putRevSlider("slide1"); ?>
    	</div>
    
    <!--    THIS IS WHERE THE PROBLEM IS-->
        <?php if (is_archive()) {
            wp_title(''); echo ' Archive - '; } ?>
    
        <?php if( is_home() && get_option('page_for_posts')  ) { ?>
        <div class="the-title"> <h1 class="entry-title">
                <a rel="bookmark"><?php echo apply_filters('the_title',get_page( get_option('page_for_posts') )->post_title); ?></a></h1> </div>
        <?php } ?>
    
        <?php if( !is_front_page() && !is_home() && !is_archive()){ ?>
            <div class="the-title">
                <?php
                the_title( '<h1 class="entry-title"><a rel="bookmark">', '</a></h1>' );
                ?>
            </div>
    
            <div class="breadcrumbs">
                <div class="container clearfix">
                    <ul class="breadcrumb_trail">
    
                        <?php  if(function_exists('bcn_display_list')  ) { bcn_display_list(); } ?>
    
                </div>
            </div><!-- breadcrumbs -->
        <?php } ?>
    
    	<div id="main" class="site-main">

    `

    apart form the qtranslate plugin
    you’ll find Breadcrums & Rev-slider,

    returning to the issue,I used the_title but I believe it should entirely be done through wp_title;
    if somebody wants to show the best-practice to achieve this I’d really appreciate_

  • The topic ‘wp_title repeats blog-title’ is closed to new replies.