• I am using the following code to list the page title in the sidebar.

    <h3>
    <?php wp_title("");?>
    </h3>

    I want to be able to do two (2) things:
    1. use this code on every page except page with post id= 1202
    2. On Page w/ id=1202, show “Test” instead.

    Below is my attempt at it, but it doesn’t work. Any help would be appreciated.

    <h3>
    <?php
    if (is_page(1202) {echo "Test"}
    else {<?php wp_title("");?>}
    ?>
    </h3>
Viewing 4 replies - 1 through 4 (of 4 total)
  • Try using:

    <h3>
    <?php
    if (is_page(1202) {echo "Test"}
    else {<?php the_title();?>}
    ?>
    </h3>
    Thread Starter quaziblue

    (@quaziblue)

    Thanks for the code, but it didn’t work. It just removes then entire snippet like my code does. Any other suggestions?

    Will this work?

    <?php
    if (is_page('1202')){echo 'Test';}
    else { ?>
    <?php echo the_title();?><? }
    ?>

    I just used this to remove a title on a specific page.

    I wonder if you all might be able to help me. I am trying to do something very similar to this.

    I have both pages and posts. I am putting the page title under my navigation (in a different area than the default placement of the title for pages).

    I have it just about working. There is not title on the home page which is correct. My two problems are:

    1) I would like the blog page to Say Blog for the title.
    2) I would like to have all the posts within the blog to have the page title Blog but not change the title of the actual blog post on the page.

    Here is the code I have so far:

    <?php if (is_home() || is_front_page() ) {
    /*Do nothing*/
    } elseif (is_category(‘1’)|| is_front_page() ) {
    /*Do nothing*/
    } else {
    the_title();
    } ?>

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Exclude Title On Certain Page and Replace with Text’ is closed to new replies.