Wordpress: Custom Field Post or Page Title H1


/ Published in: PHP
Save to your folder(s)

To create a post or page title that is different than the title above the permalink. :: HOW TO :: in the wordpress post or page administration panel -> custum field panel -> name: "customtitle" // value: "Your Post or Page Title".


Copy this code and paste it in your HTML
  1. <h1>
  2. <?php if (get_post_meta($post->ID, "customtitle", true)) : ?>
  3. <?php $key="customtitle"; echo get_post_meta($post->ID, $key, true); ?>
  4. <?php else : ?>
  5. <?php the_title(); ?>
  6. <?php endif; ?>
  7. </h1>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.