Community Forums › Forums › Archived Forums › Design Tips and Tricks › Agency Pro – Custom Backgrounds for Pages & Posts
Tagged: agency pro, background image, custom background, featured image, genesis
- This topic has 5 replies, 2 voices, and was last updated 8 years, 6 months ago by
fr06.
-
AuthorPosts
-
August 25, 2014 at 6:31 am #120882
fr06
MemberHiya!
We're using Agency Pro theme (v.3.1.1) and Genesis Framework (v.2.1.2) but wanted some pages to have a different background image. We looked at custom background plugins we found that many of them no longer seem to be supported. Agency Pro already had the functionality for adding a custom background image but we needed it to go a little further and if a page/post had a set Featured Image to use that image as the background instead of our default.
In the end I modified some php code to get the functionality we needed. To do this head to your functions.php file and look for this section:
I Modified the above section to become:
We added our custom default image by FTP into our theme/images folder. Basically what this is saying is that if it's a page or post and has a featured image then use the featured image as a background image. If there is no featured image then use the default background in our theme/images folder.
August 25, 2014 at 6:46 am #120884Genesis Developer
MemberHow are you getting featured image option for page? By default there have no featured image option for pages. Are you using any plugin?
For custom background image you'll use custom field option. There have a good plugin for this ( try Advanced Custom Fields plugin). It is working with Genesis. You will call a hook and write a custom code in your functions.php file.
August 25, 2014 at 8:28 am #120905fr06
MemberHi genwrock:
Thanks for your reply! I tested the Featured Image functionality in a clean WordPress site without Genesis or plugins and used a standard out of the box WP theme. I could see the featured image option on my page in the edit view. Have you checked that "Featured Image" is box is checked in your page screen options (on edit page)?
Thanks for the plugin, I'll take a look and see if we could use it on other builds! For this site we really wanted to limit the number of plugins as it's a large site and sometimes plugin functionality can conflict. For us this PHP code was easy to add to our modified child theme and used WP functionality which is exactly what we wanted!
August 25, 2014 at 8:53 am #120911Genesis Developer
MemberAhh... Yes. I just checked it. sorry for miss-understanding. Then it'll be quite easy and not require any plugin. Let me know you are getting functionality for your site. Otherwise I can write and test the code for you.
August 25, 2014 at 8:55 am #120912Genesis Developer
MemberLol. full code is here http://sridharkatakam.com/set-featured-image-full-sized-background-posts-pages-wordpress/ . This is for you.
August 25, 2014 at 10:01 am #120925fr06
MemberLol that's actually one of the posts I used as my jumping off point but I had to adapt it to function with a theme that already had script files. I've tested it on a couple of sites with other themes and it's working beautifully! Thanks 🙂
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.