1. Halo Guest, pastikan Anda selalu menaati peraturan forum sebelum mengirimkan post atau thread baru.

[ASK] Dinamik title tag pada wordpress (khusus Judul Blog )

Discussion in 'Panduan Forum' started by fengki, Dec 3, 2012.

  1. fengki

    fengki Ads.id Starter

    Joined:
    Apr 24, 2012
    Messages:
    67
    Likes Received:
    0
    Location:
    Lampung
    Banyak baca tentang on page seo akhirnya saya nyoba buat benerin struktur theme wordpress yang saya gunain agar lebih seo tapi Udah berhari-hari saya nyari panduan untuk bikan Dinamik heading tag (khusus Judul Blog ) ndak bisa-bisa . Memang banyak yang udh share tutorialnya namun karena kode header theme saya beda itu bikin saya jadi bingung :'(

    Karena udah mentok jadi saya minta tolong sama teman-teman y :D .

    ini kode header yang mau saya rubah heading tag (khusus Judul Blog ) agar bisa jadi dinamasis.

    <!-- Main HEADER-->

    <div class="header">
    <div class="container">
    <div class="row">
    <div class="col_12" style="position:relative;"> <!-- LOGO -->
    <?php
    $mainlogo = of_get_option('logochoose');
    if($mainlogo == '1') : ?>
    <a class="logoabs" onclick="isExit = false;" href="<?php bloginfo('siteurl');?>"><img class="logo"src="<?php echo of_get_option('logo'); ?>"/></a>
    <?php else : ?>
    <h1 class="logoabs" style="display:absolute;display:inherit;top:50px;color:white;font-size:45px;"><a style="color:white;"onclick="isExit = false;" href="<?php bloginfo('siteurl');?>"><?php bloginfo('name'); ?></a></h1>
    <?php endif; ?>

    <img src="<?php echo of_get_option('header'); ?>" alt="header"/>
    <div class="clear"></div>
    </div><!-- // LOGO --><div class="clear"></div>
    <div class="clear"></div>
    <div class="menu">
    <div class="col_8 clearleft">

    <ul id="menu">
    <li><a href="<?php bloginfo('siteurl');?>" class="home">&nbsp;</a></li>
    <?php wp_nav_menu( array( 'items_wrap' => '%3$s', 'theme_location' => 'primary', 'fallback_cb'=> 'fallbackmenu') ); ?>
    </ul>
    <div class="clear"></div>
    </div>
    <div class="col_4 omega">
    <div class="searchcol">
    <form method="get" id="searchform" action="<?php bloginfo('home'); ?>" >
    <input class="searchinput" id="s" type="text" name="s" placeholder="Search site" />
    <input type="image" src="<?php echo get_template_directory_uri(); ?>/images/searchbutton.png" class="search-submits" name="submit" alt="" />
    </form><div class="clear"></div>
    </div><div class="clear"></div>
    </div>
    <div class="clear"></div>
    </div><div class="clear"></div>
    </div> <div class="clear"></div>
    </div><div class="clear"></div>
    </div><div class="clear"></div>
    <div class="headerbtm"></div>

    <a id="reference-first" style="display:none;visibility:hidden;"href="#reference-first-message">Test the Popup</a>

    <div style="display: none;">
    <div id="reference-first-message" >
    <div class="clear"></div>
    <span><?php echo of_get_option('popupcontent'); ?></span>
    </div>
    </div>

    Mohon bantuan mastah-msatah semua ya . apa yang perlu saya rubah agar saat di home page judul blog/logo jadi H1 , setelah di halaman single berubah jadi h2/h3 ..
     
    Last edited: Dec 3, 2012
  2. wididwi

    wididwi Ads.id Pro

    Joined:
    Nov 6, 2009
    Messages:
    273
    Likes Received:
    39
    agak susah baca kodenya ... cm mungkin saya bisa mengira2x keinginan mas bro dengan dynamic title.

    Code:
    <html>
    <header>
    <title>
    <?php if (is_single() || is_page() || is_archive()) { wp_title('',true); } else { bloginfo('description'); } ?> — <?php bloginfo('name'); } ?>
    </title>
    <header>
    <body>
    web site content
    </body>
    </html>
    
    saya sendiri juga suka build theme wordpress untuk kepentingan pribadi ... tapi untuk dynamic title pasrah dengan plugin 'All In One SEO'


    untuk logo saran pribadi tidak mempergunakan H1, normal2x saja .... post title di single yang mempergunakan h1 sementara yang lain tetap pergunakan h2, h3 dst ..

    mengamati prilaku search engine, sepertinya halaman single itu yang sebaiknya di perhatikan betul seo nya di banding halaman muka.
     
  3. cahmedan

    cahmedan Super Hero

    Joined:
    Oct 2, 2012
    Messages:
    1,022
    Likes Received:
    99
    Location:
    Medan
    Code:
    <html>
    <header>
    <title>
    <?php if (is_single() || is_page() || is_archive()) { wp_title('',true); } else { bloginfo('description'); } ?> — <?php bloginfo('name'); } ?>
    </title>
    <header>
    <body>
    web site content
    </body>
    </html>
    
    Udah ane cobain code dari agan, tapi kok malah error blognya.. :(
     
  4. cahmedan

    cahmedan Super Hero

    Joined:
    Oct 2, 2012
    Messages:
    1,022
    Likes Received:
    99
    Location:
    Medan
    Ini yang works, Gan..
    Code:
    
    <title>[COLOR=#000000][B]<?php[/B][/COLOR] [COLOR=#b1b100]if[/COLOR] [COLOR=#009900]([/COLOR] is_category[COLOR=#009900]([/COLOR][COLOR=#009900])[/COLOR] [COLOR=#009900])[/COLOR] [COLOR=#009900]{[/COLOR]     
    [COLOR=#b1b100]echo[/COLOR] [COLOR=#0000ff]'Category Archive for &quot;'[/COLOR][COLOR=#339933];[/COLOR] single_cat_title[COLOR=#009900]([/COLOR][COLOR=#009900])[/COLOR][COLOR=#339933];[/COLOR] [COLOR=#b1b100]echo[/COLOR] [COLOR=#0000ff]'&quot; | '[/COLOR][COLOR=#339933];[/COLOR] bloginfo[COLOR=#009900]([/COLOR] [COLOR=#0000ff]'name'[/COLOR] [COLOR=#009900])[/COLOR][COLOR=#339933];[/COLOR] [COLOR=#009900]
    }[/COLOR] [COLOR=#b1b100]elseif[/COLOR] [COLOR=#009900]([/COLOR] is_tag[COLOR=#009900]([/COLOR][COLOR=#009900])[/COLOR] [COLOR=#009900])[/COLOR] [COLOR=#009900]{[/COLOR]     [COLOR=#b1b100]echo[/COLOR] [COLOR=#0000ff]'Tag Archive for &quot;'[/COLOR][COLOR=#339933];[/COLOR] single_tag_title[COLOR=#009900]([/COLOR][COLOR=#009900])[/COLOR][COLOR=#339933];[/COLOR] [COLOR=#b1b100]echo[/COLOR] [COLOR=#0000ff]'&quot; | '[/COLOR][COLOR=#339933];[/COLOR] bloginfo[COLOR=#009900]([/COLOR] [COLOR=#0000ff]'name'[/COLOR] [COLOR=#009900])[/COLOR][COLOR=#339933];[/COLOR] 
    [COLOR=#009900]}[/COLOR] [COLOR=#b1b100]elseif[/COLOR] [COLOR=#009900]([/COLOR] is_archive[COLOR=#009900]([/COLOR][COLOR=#009900])[/COLOR] [COLOR=#009900])[/COLOR] [COLOR=#009900]{[/COLOR]     wp_title[COLOR=#009900]([/COLOR][COLOR=#0000ff]''[/COLOR][COLOR=#009900])[/COLOR][COLOR=#339933];[/COLOR] [COLOR=#b1b100]echo[/COLOR] [COLOR=#0000ff]' Archive | '[/COLOR][COLOR=#339933];[/COLOR] bloginfo[COLOR=#009900]([/COLOR] [COLOR=#0000ff]'name'[/COLOR] [COLOR=#009900])[/COLOR][COLOR=#339933];[/COLOR] [COLOR=#009900]
    }[/COLOR] [COLOR=#b1b100]elseif[/COLOR] [COLOR=#009900]([/COLOR] is_search[COLOR=#009900]([/COLOR][COLOR=#009900])[/COLOR] [COLOR=#009900])[/COLOR] [COLOR=#009900]{[/COLOR]     [COLOR=#b1b100]echo[/COLOR] [COLOR=#0000ff]'Search for &quot;'[/COLOR][COLOR=#339933].[/COLOR]wp_specialchars[COLOR=#009900]([/COLOR][COLOR=#000088]$s[/COLOR][COLOR=#009900])[/COLOR][COLOR=#339933].[/COLOR][COLOR=#0000ff]'&quot; | '[/COLOR][COLOR=#339933];[/COLOR] bloginfo[COLOR=#009900]([/COLOR] [COLOR=#0000ff]'name'[/COLOR] [COLOR=#009900])[/COLOR][COLOR=#339933];[/COLOR] [COLOR=#009900]
    }[/COLOR] [COLOR=#b1b100]elseif[/COLOR] [COLOR=#009900]([/COLOR] is_home[COLOR=#009900]([/COLOR][COLOR=#009900])[/COLOR] [COLOR=#339933]||[/COLOR] is_front_page[COLOR=#009900]([/COLOR][COLOR=#009900])[/COLOR] [COLOR=#009900])[/COLOR] [COLOR=#009900]{[/COLOR]     bloginfo[COLOR=#009900]([/COLOR] [COLOR=#0000ff]'name'[/COLOR] [COLOR=#009900])[/COLOR][COLOR=#339933];[/COLOR] [COLOR=#b1b100]echo[/COLOR] [COLOR=#0000ff]' | '[/COLOR][COLOR=#339933];[/COLOR] bloginfo[COLOR=#009900]([/COLOR] [COLOR=#0000ff]'description'[/COLOR] [COLOR=#009900])[/COLOR][COLOR=#339933];[/COLOR] 
    [COLOR=#009900]}[/COLOR]  [COLOR=#b1b100]elseif[/COLOR] [COLOR=#009900]([/COLOR] is_404[COLOR=#009900]([/COLOR][COLOR=#009900])[/COLOR] [COLOR=#009900])[/COLOR] [COLOR=#009900]{[/COLOR]     [COLOR=#b1b100]echo[/COLOR] [COLOR=#0000ff]'Error 404 Not Found | '[/COLOR][COLOR=#339933];[/COLOR] bloginfo[COLOR=#009900]([/COLOR] [COLOR=#0000ff]'name'[/COLOR] [COLOR=#009900])[/COLOR][COLOR=#339933];[/COLOR] 
    [COLOR=#009900]}[/COLOR] [COLOR=#b1b100]elseif[/COLOR] [COLOR=#009900]([/COLOR] is_single[COLOR=#009900]([/COLOR][COLOR=#009900])[/COLOR] [COLOR=#009900])[/COLOR] [COLOR=#009900]{[/COLOR]     wp_title[COLOR=#009900]([/COLOR][COLOR=#0000ff]''[/COLOR][COLOR=#009900])[/COLOR][COLOR=#339933];[/COLOR] [COLOR=#009900]}[/COLOR] [COLOR=#b1b100]else[/COLOR] [COLOR=#009900]{[/COLOR]     [COLOR=#b1b100]echo[/COLOR] wp_title[COLOR=#009900]([/COLOR] [COLOR=#0000ff]' | '[/COLOR][COLOR=#339933],[/COLOR] [COLOR=#009900][B]false[/B][/COLOR][COLOR=#339933],[/COLOR] right [COLOR=#009900])[/COLOR][COLOR=#339933];[/COLOR] bloginfo[COLOR=#009900]([/COLOR] [COLOR=#0000ff]'name'[/COLOR] [COLOR=#009900])[/COLOR][COLOR=#339933];[/COLOR] [COLOR=#009900]}[/COLOR] [COLOR=#000000][B]?>[/B][/COLOR]
    </title>
    
     
  5. fengki

    fengki Ads.id Starter

    Joined:
    Apr 24, 2012
    Messages:
    67
    Likes Received:
    0
    Location:
    Lampung
    Sepertinya saya yang salah pertanyaannya :D .
    yang saya maksud itu bikin heading tag h1 untuk judul blog tapi setelah di halaman post h1 di judul blog berubah jadi h2/h3 .
    kira-kira dari kode header di atas apa yang harus saya rubah agar bisa dinamis heading tagnya mastah ?
     
  6. cahmedan

    cahmedan Super Hero

    Joined:
    Oct 2, 2012
    Messages:
    1,022
    Likes Received:
    99
    Location:
    Medan
    OWalah... :D pantesan saya perhatikan yang agan tulis di atas itu bukan file header.php, tapi mainheader.php atau main.php gitu ya?
    Coba entar ane coba-coba dulu ya Gan... soalnya pernah tau ilmunya tapi males nyobain.
     
    Last edited: Dec 3, 2012
  7. cahmedan

    cahmedan Super Hero

    Joined:
    Oct 2, 2012
    Messages:
    1,022
    Likes Received:
    99
    Location:
    Medan
    Pake plugin ini aja Gan biar gak repot. Cuma perlu edit header.php-nya dikit.
     
  8. fengki

    fengki Ads.id Starter

    Joined:
    Apr 24, 2012
    Messages:
    67
    Likes Received:
    0
    Location:
    Lampung
    Fungsi plugin itu untuk apa mastah ?
     
  9. cahmedan

    cahmedan Super Hero

    Joined:
    Oct 2, 2012
    Messages:
    1,022
    Likes Received:
    99
    Location:
    Medan
    Optimasi H1 dan H2. Buatan anak bangsa tu.. :)
     

Share This Page