How to change background images for 'header' tag
-
I want change header’s background image through WordPress back-end.
Current solution:
create a post called, ‘background image’. The content of it is empty but has a featured image.
In my header.php, I use code as below:
<header style="background: url('<?php echo wp_get_attachment_url( get_post_thumbnail_id($post_id));?>') no-repeat top center / cover;">
So, I can change the background image by giving a new featured image to the post of ‘background image’.
Is there any better way to achieve that?
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘How to change background images for 'header' tag’ is closed to new replies.