Viewing 4 replies - 1 through 4 (of 4 total)
  • You could change the page name, then change the menu label back to what it was under Appearance > Menus. Changing the page name (to my knowledge) doesn’t change the slug(address).

    Changing the page name would also change the browser title, assuming you have <title><?php the_title();?></title> in the head of your document.

    If you only want to change this one title on this one page, check to see if that page is called and swap the title:

    Assuming the page id in question is 72
    <?php if($post->ID==72):?>
    <h2>My New Title</h2>
    <?php else: the_title();?>

    If this is something you want to do on all of your pages, you can start your page with a Heading tag with your custom page text and remove <h2><?php the_title();?></h2> from your theme?

    So your (highly truncated) code would look like this:

    ...
    <title><?php the_title();?></title>
    ...
    <?php if(have_posts()):while(have_posts()):the_post();?>
      <div class="entry"><?php the_content();?></div>
    <?php endwhile; endif;?>
    Thread Starter blazeblaze

    (@blazeblaze)

    Hi,

    Thanks for suggestions.

    Yes, changing the page name changes everything.

    The idea of implementing the code seems like the solution. I’ve tried to put it on the page in different ways, but then the browser says: the page undergoes maintanance or there was en error in programming ??

    May you write how to put this code propoerly:

    <?php if($post->ID==72):?>
    <h2>My New Title</h2>
    <?php else: the_title();?>

    here (my page.php file):

    <?php if ( function_exists('yoast_breadcrumb') ) { yoast_breadcrumb('<p id="breadcrumbs">','</p>'); } ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div <?php if (function_exists("post_class")) post_class(); else print 'class="post"'; ?> id="post-<?php the_ID(); ?>">
    <h2><a title="<?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    <?php edit_post_link(__('Edit this page','lightword'), '', ''); ?>
    
    <?php the_content(''); ?>
    Thread Starter blazeblaze

    (@blazeblaze)

    New Nine Media,

    Thanks for the idea! ??

    Here is a sample solution that may be further modified that works (thanks Sergey):

    <div <?php if (function_exists("post_class")) post_class(); else print 'class="post"'; ?> id="post-<?php the_ID(); ?>">
    <h2><a title="<?php if($post->ID==38) print 'My New Title'; else the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><?php if($post->ID==38) print 'My New Title'; else the_title(); ?></a></h2>
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Change page title, but not page address and name in the menu’ is closed to new replies.