WordPress.org

Ready to get started?Download WordPress

Forums

Background Per Page
[resolved] Custom background appears even when the post is part of a list (11 posts)

  1. NorthDPole
    Member
    Posted 1 year ago #

    hi, first congractulations for the great and very helpful plugin.
    It saved me hours of tinkering :-).

    you can find the example i'm talking about here http://pelloponisos.telesto.gr/

    using the plugin i have placed a default background on the body which is a black colour as you can see here http://pelloponisos.telesto.gr/?p=1

    on the test post i have placed an image as background as you can see here
    http://pelloponisos.telesto.gr/?p=4

    finally on the test2 post i have placed the background you see here
    http://pelloponisos.telesto.gr/?p=14

    the result is that on the front page the default colour is overwritten by the image of the latest post
    (according to firebug it doesn't load every post background just the default and the last one)

    is it a bug, or did i use it wrong?

    http://wordpress.org/extend/plugins/background-per-page/

  2. NorthDPole
    Member
    Posted 1 year ago #

    i fixed it,
    you also had a bug:
    in add_background_per_page()
    you were only putting a background if there was an image so i changed the
    if($src!="") to
    if($src != '' || $color != 'Transparent')

    also i added some functionality to assign a background to the category pages and to every post belonging in that category which does not have a specific background assigned.

    Its not beautiful code and it lacks a couple functionality/usability tweaks but if you want to include it to the next version i can work on it a bit more, just drop a line :-)
    you can view the results in the page i mentioned above

  3. Fish Can't Whistle
    Member
    Plugin Author

    Posted 1 year ago #

    Hello!

    Sounds like some great work! Do you want to send me the code and I'll stick it in?

    :-)

  4. NorthDPole
    Member
    Posted 1 year ago #

    Here is it

    https://github.com/northdpole/PelopSite/blob/background_changing_plugin/background-per-page.php

    https://github.com/northdpole/PelopSite/blob/background_changing_plugin/admin-page.php

    Its a quick and dirty solution pieced together on-the-fly but it works.

    If you want to make it better feel free :-)
    otherwise i'll probably get back to it around mid-November or so.

  5. cheltenhammedia
    Member
    Posted 1 year ago #

    Hi guys, we are having the same problem.

    We have assigned a background image to each page and that is working fine. But for each taxonomy (blog category) we have hard coded the background image for each category into the theme. The problem now is that we are getting (for a fraction of a second) the last image assigned using your widget before the hardcoded background appears.

    When checking with firebug, your background is being called first before our customised one loads. We have tried to change this so that the default background is called first but to no avail.

    It is a similar problem to what NorthDPole has and we wondered if you had incorporated his idea into an update? Otherwise, is it possible to insert a reset code into the widget so that it does not call the last assigned background image but assigns the default one instead?

    Many thanks

  6. NorthDPole
    Member
    Posted 1 year ago #

    hi cheltenhammedia I would propose to patch the plugin with the code I provide above, and substitude the hardcoded values with the more easily customizable plugin options.

    A more immediate solution to your problem would be to substitute only this file
    https://github.com/northdpole/PelopSite/blob/background_changing_plugin/background-per-page.php

    and in function add_background_per_page() line 171
    Modify the if statement to make $data = array('src'=>"",'color'=>'Transparent');

    and after the if block (line:207) insert an else statement which echoes your hardcoded values

    another solution which I'm not sure if it works would be to put an Importand css marker for your backgrounds and maybe place your background before the plugin's one

  7. cheltenhammedia
    Member
    Posted 1 year ago #

    Thanks for your response on this NorthDPole.

    I tried working with your code but just coould not get it to work. I removed the include statement (line 13) for admin-page.php but the background would just not work at all. I could not find the $data = array(....); statement in the function you mentioned.

    Any chance of emailing me anthony [at] cheltenhammedia [dot] com and I could go through this with you if possible?

    Regards

    Anthony

  8. horria
    Member
    Posted 1 year ago #

    Hi NorthDPole,

    thanks for the code, it seems to be on the right track.

    However it seems to work just for one category. As soon as I add an image to another category, the first one dissapears.

    Any suggestions?
    Thanks

  9. horria
    Member
    Posted 1 year ago #

    Also, it would be great if a sub-categories of a category would retain the parent's image (as in the original plugin)

    Thanks

  10. NorthDPole
    Member
    Posted 1 year ago #

    hi horria, in principle they should if they dont have a background of their own

    the inheritance goes as follows: If category has image append the css for the category
    if post has image append for post

    it works as demonstrated here:
    category 1
    http://pelloponisos.telesto.gr/test3/

    category 2
    http://pelloponisos.telesto.gr/test2/

    single post
    http://pelloponisos.telesto.gr/test/

    check this piece of code (i did some bugfixing and added a couple of features)
    https://github.com/northdpole/PelopSite/tree/master/peloponnisos-plugins

    note: the example links will be broken after sunday night

  11. Manoj Karmocha
    Member
    Posted 1 year ago #

    Hi NorthDPole,

    First of all i would like to thank you for contributing your effort to make a bit change in Background per page, also I would like to thank fish can't whistle for developing this plugin, I wonder this plugin will surely do good in coming days if you both guys join together to re-structure this plugin to suit post, catagory and page needs.

    Currently, if we only use this plugin without northdpole code we get can easily implement different background in every single page and post but the drawback is that we cannot assign different background for homepage and it is because the background is taken from latest post page.

    Now if we use northdpole code the drawback i found is that we cannot change page background individually but the code works fine for post and the homepage background.

    I would like to ask a quick question, Can anybody here tell me how to get my page background also work?

    Regards,
    Manoj
    http://www.manoj.com.np

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic