Support » Fixing WordPress » Custom Fields on Pages outside of loop?

  • Resolved meko


    I would like to have two unique pieces of text — a title and subtitle — displayed at the top of each of my pages.

    I thought I could accomplish this using custom fields, but I am not sure if it is possible to get the values of custom fields outside of the loop?

    I tried the Get Custom Field Values plugin, but it displays the same text for each of the pages instead of pulling the custom field value for each page.

    Any suggestions?

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

    You can go into page.php file and hardcode what you want in there above the loop and use some if/else conditions to switch out the text for various pages. 🙂

    Thanks. I did figure out a way to do just what I wanted using a combination of the SEO Title Tag plugin and if/else statements. I installed the plugin, and added the following to page.php:

    <div id="header">
    <h1><?php if(is_home()) {
    			echo 'Home Page Title';
    <h2><?php if (function_exists('seo_title_tag')) { seo_title_tag(); } else echo 'subtitle'; ?></h2>

    It looks kind of like this on the site (plus some css formatting):
    Title Subtitle

    Not sure if this was the best way to implement this, but it works for me 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom Fields on Pages outside of loop?’ is closed to new replies.