Title: Post navigation &#8211; background images
Last modified: August 31, 2016

---

# Post navigation – background images

 *  Resolved [Argumentum](https://wordpress.org/support/users/argumentum0/)
 * (@argumentum0)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/post-navigation-background-images/)
 * Hi,
 * I am having a little issue with the background images of the post navigation 
   links.
 * I use a Gazette child theme. In my child theme, I modified the file `single.php`
   in order to restrict the previous/next post links to posts within the same category
   only. To do that, I added `'in_same_term' => true,` in `the_post_navigation( 
   array( ) );`.
 * It does work … but only for the links themselves. With `'in_same_term' => true`,
   the navigation “banners” do show the links (and its respective titles) to the
   previous/next posts of the same category, but with wrong background images. The
   background images shown are not from the actual linked posts, but from the previous/
   next posts of the whole blog (irrespective of its category).
 * Apparently the background image is set by the function `gazette_post_nav_background`
   in the file `\inc\template-tags.php`, but I have no idea what I have to do to
   make it work like `the_post_navigation` with `'in_same_term' => true,`.
 * Two questions, then:
 * 1. What modifications do I have to do to get the right background images (when
   using `'in_same_term' => true,`)?
 * 2. In case I need to edit the file `\inc\template-tags.php`, would it be possible
   to do so in a child theme? Or will I have to edit the file in the parent theme
   and be careful with theme updates? (If it is impossible to edit such file in 
   a child theme, simply adding something to the file `functions.php` would certainly
   be preferable?)
 * Thanks in advance!

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Thread Starter [Argumentum](https://wordpress.org/support/users/argumentum0/)
 * (@argumentum0)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/post-navigation-background-images/#post-7063311)
 * I’ve successfully edited the file `\inc\template-tags.php` to show the right 
   background images in the post navigation — just had to change the first parameter
   of `get_adjacent_post` from `false` to `true`.
 * Now I just need to know how I can use this in a child theme, since the file is
   in a subfolder. I have tried to simply copy the original directory hierarchy,
   but the file was not loaded. I suppose only the files in the root folder of the
   theme are automatically overrode by its respective child versions, then.
 * I see `\inc\template-tags.php` is loaded in the parent `functions.php` with `
   require get_template_directory() . '/inc/template-tags.php';`, but I have no 
   idea how to override this `require` in a child theme.
 * Any help will be appreciated. Thanks again!
 *  Moderator [Kathryn Presner](https://wordpress.org/support/users/zoonini/)
 * (@zoonini)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/post-navigation-background-images/#post-7063325)
 * `gazette_post_nav_background()` is not a “pluggable” function (it’s not wrapped
   in a conditional) so it’s not possible to override it simply in a child theme.
 * The technique you’d use is to unhook the function from the parent and then add
   your new function in a child theme, so there are no conflicts.
 *  Moderator [Kathryn Presner](https://wordpress.org/support/users/zoonini/)
 * (@zoonini)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/post-navigation-background-images/#post-7063326)
 * If you’re not familiar with this, here’s a tutorial that may help:
 * [http://code.tutsplus.com/tutorials/a-guide-to-overriding-parent-theme-functions-in-your-child-theme–cms-22623](http://code.tutsplus.com/tutorials/a-guide-to-overriding-parent-theme-functions-in-your-child-theme–cms-22623)–
   see the section “Removing Functions From Hooks.”
 *  Thread Starter [Argumentum](https://wordpress.org/support/users/argumentum0/)
 * (@argumentum0)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/post-navigation-background-images/#post-7063329)
 * Great, I did what you suggested, and it worked!
 * I was first looking for a way to override the `require` statement in the parent`
   functions.php`, but I couldn’t find a way to do it. That’s exactly what this 
   guy wanted: [http://stackoverflow.com/questions/32554393/how-to-override-a-parent-file-in-a-child-wordpress-theme-when-parent-file-is-bei](http://stackoverflow.com/questions/32554393/how-to-override-a-parent-file-in-a-child-wordpress-theme-when-parent-file-is-bei).
 * But simply unhooking the original function and including the new version with
   a different name worked. Thanks again!
 *  Moderator [Kathryn Presner](https://wordpress.org/support/users/zoonini/)
 * (@zoonini)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/post-navigation-background-images/#post-7063330)
 * Glad that did the trick!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Post navigation – background images’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/gazette/1.1.1/screenshot.png)
 * Gazette
 * [Support Threads](https://wordpress.org/support/theme/gazette/)
 * [Active Topics](https://wordpress.org/support/theme/gazette/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/gazette/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/gazette/reviews/)

## Tags

 * ["background-image"](https://wordpress.org/support/topic-tag/background-image/)
 * [child theme](https://wordpress.org/support/topic-tag/child-theme/)
 * [post navigation](https://wordpress.org/support/topic-tag/post-navigation/)

 * 5 replies
 * 2 participants
 * Last reply from: [Kathryn Presner](https://wordpress.org/support/users/zoonini/)
 * Last activity: [10 years, 3 months ago](https://wordpress.org/support/topic/post-navigation-background-images/#post-7063330)
 * Status: resolved