• Hello… Is it possible to have different header TEXT(not image!) for different pages?

    Right now upon landing on the home page at https://www.ctdraincleaning.net the header TEXT has “Call Now To Schedule Service (866)-626-4989.

    My state only has two different area codes so I want to create a page for each town in ct with their respected phone number.

    So instead of having our Hartford, CT page say:
    “Call now to schedule service (866)626-4989”
    I want it to say ……
    “Call now to Schedule service in Hartford, CT (203) 859-0241.

    …and so on for each town in CT.

    How can I do this?

    Thanks in advance!

Viewing 3 replies - 1 through 3 (of 3 total)
  • If the text “Call Now To Schedule Service (866)-626-4989” is found in header.php, you can do this by creating blocks of if else functions for each page like:

    if( is_page(2) ) {
        echo '<h1>First page text</h1>';
    else {
        echo '<h1>Second page text</h1>'
    }

    You can also do this by using custom fields. Create custom fields for your pages, and for each page you can set the text you want that will show in the header, like this:

    <?php
    	global $post;
    	$id = $post->ID;
    	if( get_post_meta($id, 'sub_title', true) != 'no-sub' ) : ?>
    	<div class="sub-title">
    		<div class="inner-sub-title container">
    			<h1>
    				<?php
    				    if ( 'post' == get_post_type() ) {
    						echo 'This will appear on blog page';
    					} else {
    				    	echo get_post_meta($id, 'sub_title', true);
    					}
    			    ?>
    			</h1>
    		</div>
    	</div>
    <?php endif; ?>

    In the example above, the custom field name I used is “sub_title”, I used this code to set sub titles for each of my page differently.

    You can see a similar example I used for my site, where the banner changes image and titles for each page: My website

    That’s it for header.php

    Thread Starter sabrinao

    (@sabrinao)

    Hello… thanks for your response! The text is not in my header .php..i am using a genesis sample child theme. I added that section through css and created a div class section in the header widget area. How would I go about creating if else functions in the header? I am familiar with that and already have some coding in my functions.php.

    I’m sorry but as you appear to be using a commercial theme, you need to seek support from the theme’s developer/vendor. We do not have access to, nor do we support, commercial products here.
    Try https://www.studiopress.com/support

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Different header TEXT for each page’ is closed to new replies.