Background Image in Custom post Type

Posted in: Newspaper
Post count: 4

Hello!
I have created a new custom post type and I cannot put a background image.
I have copied template 8 for the custom type, (single-discs and loop-single-discs). However I can find how to make the wallpaper work.
Sin Fondo

Can you help me?
Thank you

  • This topic was modified 6 years by srchus.
Post count: 18283

Hello !

Please note that at the moment Custom Post types are not recognized by the Cloud library templates, therefore the result you are trying to achieve is not possible at the moment.

Thank you !

Post count: 4

I understand that it is not possible to configure it from the control panel.
But is it impossible to add a background from code?

It is possible that I was not clear enough in my question. Im sorry.
Simply adding this code would already work:

`$td_post_featured_image = td_util::get_featured_image_src($post->ID, 'full');
if (!empty($td_post_featured_image)) {
td_js_buffer::add_to_footer(
'jQuery(window).ready(function() {' . "\r\n" .
'(function(){' . "\r\n" .
'jQuery("#td-outer-wrap").css("background","url(' . $td_post_featured_image . ') fixed");' .
'jQuery("#td-outer-wrap").css("background-repeat","no-repeat");' .
'jQuery("#td-outer-wrap").css("background-size","cover");' .
'})();' . "\r\n" .
'});'
);
}`

Doesn’t the template have a cleaner way to do it?
Thank you!

  • This reply was modified 6 years by srchus.
  • This reply was modified 6 years by srchus.
Post count: 18283

Hello !

Please make sure that you have followed correctly all the steps as you can see here: https://forum.tagdiv.com/custom-post-type-support/ And also please make sure that your child theme is set up properly as you can see here: https://forum.tagdiv.com/the-child-theme-support-tutorial/

Let us know the results

Thank you !

Viewing 4 posts - 1 through 4 (of 4 total)
The forum ‘Newspaper’ is closed to new topics and replies.