how to add h1 in logo wordpress only in header

My site is : Design Spicy it’s on wordpress

I want to place h1 in home page logo only if post page regular logo i uses image logo how can i put the h1 text
i tired that but not working fine i want seo optimize h1 in logo

Read More
<?php
    if ( is_front_page()) 
    { ?>
        <h1>
            <a href="http://designspicy.com/">
                <img src="<?php bloginfo('template_directory'); ?>/image/logo.png" alt="" title="Design Spicy">
            </a>
           Design Spicy
        </h1>
<?php 
    } 
    else 
    { ?>
        <a href="http://designspicy.com/">
            <img src="<?php bloginfo('template_directory'); ?>/image/logo.png" alt="" title="Design Spicy">
        </a>
<?php 
    } 
?>

any way to do this ? without change design ?

Related posts

Leave a Reply

3 comments

  1. Check the code i sure it’s work 🙂

    <?php
    if (is_home() || is_front_page())
    { ?>
       <h1 style="font-size:0px">Design Spicy</h1>
       <a href="http://designspicy.com/"><img src="<?php bloginfo('template_directory'); ?>/image/logo.png" alt="" title="Design Spicy"></a>
    
    <?php 
    } 
    else 
    { ?>
        <a href="http://designspicy.com/"><img src="<?php bloginfo('template_directory'); ?>/image/logo.png" alt="" title="Design Spicy"></a>
    <?php } ?>
    
  2. if you want to add something only on homepage you must use

    if (is_home() || is_front_page())
    

    instead of

    if ( is_front_page()) 
    

    using jquery you can do this

    here is your html

    <h1>
        <a href="http://designspicy.com/"><img src="<?php bloginfo('template_directory'); ?>/image/logo.png" alt="" title="Design Spicy"></a>Design Spicy</h1>
    

    and then use jquery

    $(function(){
       text = $('h1').css('font-size', 0);
     });
    
  3. You can try this error correction   
     <?php
        if ( is_home()) 
        { ?>
           <h1>
           <a href="http://designspicy.com/"><img src="<?php bloginfo('template_directory'); ?>/image/logo.png" alt="" title="Design Spicy"></a></h1>
           <h1>Design Spicy</h1>
        <?php 
        } 
        else 
        { ?>
            <a href="http://designspicy.com/"><img src="<?php bloginfo('template_directory'); ?>/image/logo.png" alt="" title="Design Spicy"></a>
        <?php } ?>
    

    and also :

    $(document).ready(function(){
       $('h1:nth-child(2)').css('font-size', 0);
     });