Change the title/button on individual pages

Hi there,

I want to change the individual title on each pages along with the button, is this possible?!

I have uploaded an image below.

Thanks,
Tom

Hello Tom,

You can manage different main header image for specific page with Unique Headers plugin.

To change the default header content, you can use custom jQuery code solution by doing the below steps:

  1. Install and activate the TC Custom JavaScript plugin
  2. Go To Appearance > Custom JavaScript
  3. Paste the following code into the provided box
(function($){

  $.fn.addHeaderTextAndButton = function(title, buttonText, buttonURL){

    if( this.length && $('.header-text').length ) {
      $('.header-info').find('.header-text').text(title);
      $('.header-info .header-buttons').find('a').text(buttonText);
      $('.header-info .header-buttons').find('a').attr('href', buttonURL);
    }

  };

  // Header title and button for page 2
  $('.page-id-2').addHeaderTextAndButton('Custom Header Title', 'My Button', 'https://yoursite.com/page');

})(jQuery);

Edit this line in the code above:

  $('.page-id-2').addHeaderTextAndButton('Custom Header Title', 'My Button', 'https://yoursite.com/page');

Replace the number 2 in this class selector .page-id-2 with your page ID number. You can get it when you’re editing a page. In the web browser’s address bar, you’ll see URL address that reads something like yoursite.com/wp-admin/post.php?post=2&action=edit.

If you have 3 pages to have different header content, you will have three lines:

$('.page-id-2').addHeaderTextAndButton('Custom Header Title 2', 'My Button', 'https://yoursite.com/page');
$('.page-id-7').addHeaderTextAndButton('Custom Header Title 7', 'My Button', 'https://yoursite.com/page');
$('.page-id-9').addHeaderTextAndButton('Custom Header Title 9', 'My Button', 'https://yoursite.com/page');
  1. Update

Regards,
Kharis

Excellent, Thanks a lot

You’re welcome!

Please let us know in a new topic if you have any further questions, or if we can provide you with any other assistance.

Regards,
Kharis