• elbalazo

    (@elbalazo)


    Hi, I have asked this before, but I’m just not able to resolve this.
    How can I hack WP to be able to create custom <title> tags for my static pages? Plugin or loop hack will do.
    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Michael

    (@alchymyth)

    you could some code like this:

    <title>
    <?php if(is_page('3')) { echo 'custom title tag of page 3'; }
    elseif(is_page('17')) { echo 'custom title tag of page 17'; }
    else { wp_title('&laquo;', true, 'right'); bloginfo('name'); } ?></title>

    conditional tags:
    http://codex.ww.wp.xz.cn/Conditional_Tags#A_PAGE_Page

    question: where and how would you define/save the custom titles?
    if you are using custom fields, you code could look something like this:

    <title>
    <?php if(is_page()) { echo get_post_meta($post->ID, 'custom_title', true); }
    else { wp_title('&laquo;', true, 'right'); bloginfo('name'); } ?></title>

    (not tested)

    depends on the current code of the title tag, and what you would like to show if it is not a page.

    i assume that some seo plugins might handle custom title tags for pages as well.

    Thread Starter elbalazo

    (@elbalazo)

    Hi there and thanks,
    I want to include a custom field to manually enter the title tag contents. I’ll give this code a try.
    Cheers.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Customize Static Page Title Tags’ is closed to new replies.