Custom page-header.php?

I want to have a custom page-Header for the blog listing page (not front page).

I created a custom page called page-logbook.php and a custom page Header under templates called page-header-logbook.php

I call it in page-lookbook.php with this line:

<?php get_template_part('templates/page', 'header-logbook'); ?>

but nothing happens. What am I/could I be doing wrong?

why not a php include for the header?

@pelayo_mao thanks for your response. While that would be a solution I thought the roots way is how I tried to do it!?

An idea, try (ā€˜templatesā€™ . ā€˜page-header-lookbookā€™)

Not shure of this. Im not expert.
probably reading documentarion
again is what you need

Have you made sure page-logbook.php is being used as the template? The get_template_part code looks fine.

I just double checked that the correct page template is in place. I also tried<?php get_template_part('templates/page-header-logbook'); ?> which didnā€™t do the trick. I think Iā€™ll play with a fresh local installation on XAMPP and see if itā€™s the same there.

Itā€™s really weird. I tinkered a bit with a fresh localhost install. If I replace the string ā€œlogbookā€ with another string, it works, e.g.

base-page-test.php
page-test.php (with template name Test Template, of course)
templates/page-header-test.php

Working on a new project, I ran into the same issue again (didnā€™t solve the former, btw). It seems this is only the case with the page-header for the blog. Can anybody confirm this? The file structure basically works as Iā€™m using individual background-images per page, itā€™s just an issue with the page-header for the blog.

As I have a limited number of pages, itā€™s not a big deal to use a custom page-header per page and modify the default page-header as needed for the blog. However, I think this is not the way things should workā€¦

I know itā€™s probably not this but are you using adblock?

I run into problems with it sometimes, last one was advenced custom field named ā€˜reklamaā€™ (advertise) and this bastard was blocking it somehow.

Itā€™s worth trying.

Thanks, I_dudzic, no, itā€™s not adblocking and itā€™s not utilizing a name which is related to spam. And as I said it works perhaectly on pages, categories and tags.

Could be that if youā€™re copying the code from somewhere there may be some non UTF-8 characters??

Nope, but I finally solved the riddle!

Actually itā€™s logicalā€¦

Hereā€™s the solution:

  1. Create/select a page in your backend which the blog will be associated with, for ease of explanation, letā€™s name the page ā€œBlogā€
  2. copy base.php to base-index.blog.php
  3. copy index.php to index-blog.php
  4. Now you can edit the first line to use a custom page-header with it (ā€˜header-blogā€™) and create a custom pageheader by copying page-header.php to page-header-blog.php

It wouldnā€™t work with just modifying index.php and creating a custom page header for all the other pages as the index.phpā€™s page-header would be pulled for archive pages as well, so one had to create a custom page header for every category or tag if thatā€™s noit desired.

Hope it helps someone else.