[Resolved] Add background image without wp editor

Home Forums Support Add background image without wp editor

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #338732
    Evadex

    Hi GP,
    I would like to know the CSS code to add a picture in background without to use the wp editor.
    With the very good help of GP, I know now it’s possible to use background-image url(‘http://…..’) but if I put my picture “sun.jpg” in a folder “pictures” inside the first folder theme “generatepress”, what’s the CSS ?
    I’ve ever test : background-image url(../pictures/sun.jpg) or url(./pictures/sun.jpg) or url(‘../picture/sun.jpg’) or url(“../picture/sun.jpg”) but no effect.
    Of course, thank you very much for your help

    GP Premium 1.3.1
    #338735
    Leo
    Staff
    Customer Support

    Hi there,

    Just want to double check, so you don’t want to use the Background Images add-on in the customizer?
    https://docs.generatepress.com/article/backgrounds-overview/

    Any reason for that?

    Let me know 🙂

    #338813
    Evadex

    Hi Leo,
    Thank you for your answer of yesterday (add Simple CSS and the code: background-image: url(‘http://id picture’). With this, I’m happy to use different pictures on different templates.
    It’s not possible (or I don’t know how to do) with Background images add-on beacause it’s the same picture for every templates.
    I’ve sean a solution to directly import a picture from a folder (inside the generatepress theme folder), with the code : background: url(../Folder/picture.jpg) not background-image: url(‘http://id of picture’)
    it would be faster to charge.?.
    Unfortunatly, I’ve ever test some solutions (first post) without effect.
    Thanks for your help !

    #338849
    Tom
    Lead Developer
    Lead Developer

    You would need to use the full URL to the image instead of the relative URL.

    You could use a relative URL if you were adding your CSS into your child theme style.css file, and your images were also in your child theme folder.

    #338897
    Evadex

    Thank you for your answer, I’m beginner, it’s an honor to speak with you.
    I tested with a parent theme but I can’t ask a picture in the same folder. May be “../” or “./” are not good or I don’t use the good code, certainly you know the good code better than me (background-image or without “-image” per exemple ?).
    In addition to this, I don’t know if the child stlyle.css file will charge after the css parent file and I’ll can’t change the font-size or family directly with the theme generatepress .
    Per exemple, my primary navigation return to the default parameters.
    Finaly, I think to return at the parent theme and use absolute URLs, as your judicious advise.
    I let you close this post. Thank you very much for your attention, and sorry for my low English level, in informatic development too 🙂

    #338912
    Tom
    Lead Developer
    Lead Developer

    I definitely think using the full URL is the best route to take 🙂

    No problem! Your English is very good!

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.