How To Display Different Header Content On Different WordPress Pages
by Marshall | Apr 7, 2015 | Blog |
In order to get different text, image or hmtl code on a given page, you can use is_page function. Here is a sample way on how you can do create separate telephone numbers on different pages on a WordPress website. (The code below goes anywhere on the page header, footer or any area that can execute a php file.
We are using Page Slugs (URL pattern). You can also use page ID.
Toll Free: 000-000-0000
';
}
elseif(is_page('epson-printer-support')){
echo '
Toll Free: 000-000-0000
';
}
elseif(is_page('canon-printer-support')){
echo '
Toll Free: 000-000-0000
';
}
elseif(is_page('brother-printer-support')){
echo '
Toll Free: 000-000-0000
';
}
elseif(is_page('lexmark-printer-support')){
echo '
Toll Free: 000-000-0000
';
}
else {
echo '
Toll Free: 000-000-0000
';
}
?>