WordPress.org

Ready to get started?Download WordPress

Forums

Site Background Slider
[resolved] Not working on Custom Template Home Page (36 posts)

  1. DHewitt
    Member
    Posted 1 year ago #

    I have this plugin installed on this website: http://rorymoore.com/test/

    What I would like is the slider on the Homepage only.

    The problem is that I created a custom template for the homepage so it's not the themes default homepage. If I have the 'Show Only on Home Page' option checked it doesn't appear on any page. If I have it unchecked it displays on all pages.

    I really hope this can be fixed.

    Thanks

    http://wordpress.org/extend/plugins/site-background-slider/

  2. Press Pixels
    Member
    Plugin Author

    Posted 1 year ago #

    Hello!

    Seems I am not getting any notices of these messages, sorry for the late response! We have add this into the latest version (plus also image resizing) - so if you update to version 1.0.7 you will be all sorted out, enjoy!

  3. DHewitt
    Member
    Posted 1 year ago #

    Thanks Press Pixels but I updated to 1.0.7 and it did not resolve the problem.

    Any other ideas?

  4. Press Pixels
    Member
    Plugin Author

    Posted 1 year ago #

    You see there is a conflict when selecting a home page - as WordPress has many ways of doing this - and it can also be specific to your theme - we are investigating at the moment, update should be soon ;)

  5. Frumph
    Member
    Posted 1 year ago #

    Custom template home pages are *not* home pages and should check for is_front_page() and other methods other then is_home()

    if (is_home() || is_front_page())

    $home_only = get_option('sbs_just_home', 0 );
        if ( $home_only && (is_home() || is_front_page()) ) {
    		add_action( 'wp_head', array('SiteBackgroundSlider', 'setBackgroundSlider') );
    		if ( get_option( 'sbs_link', 0 ) == 1 ) {
    			add_action( 'get_template_part_content', array('SiteBackgroundSlider', 'setBackLink') );
    		}
        } else {
    		add_action( 'wp_head', array('SiteBackgroundSlider', 'setBackgroundSlider') );
    		if ( get_option( 'sbs_link', 0 ) == 1 ) {
    			add_action( 'get_template_part_content', array('SiteBackgroundSlider', 'setBackLink') );
    		}
    	}

    ^ changes to the slider !is_admin() area

    Also it's possible that the query before the action occurs to run the slider needs a wp_reset_query(); because of bleeding information into other areas that is changed from the base query. This is a theme problem when that happens, which the wp_query could have been changed. Although looking at your code (press pixels) it looks like they're not doing much with is_home() is_single() or any other conditionals, which unfortunately WordPress does a lot of relative things that it would be a benefit to utilize.

  6. Press Pixels
    Member
    Plugin Author

    Posted 1 year ago #

    Actually we have tried that :) the reason is_home is there is because of other theme users which require it - you see this is the problem and this is why we land up with multiple installations needing unique solutions.

    I have thought of a better solution, just need to find time to code it - will add an input box where you can type your home URL - and then if matched in the above conditional (rewritten) it will preform the only home page function - better and will work for everyone ;)

    So... give me a bit of time will get it done ;)

  7. DHewitt
    Member
    Posted 1 year ago #

    Frumph, I really appreciate your input but unfortunately I am a novice web designer and don't really understand anything you said.

    PP, If you can do what you say that would be amazing. Thanks.

  8. tomwgf
    Member
    Posted 1 year ago #

    hi
    this is a great plugin - but i am also having problems trying to get it to work on a specific page. When i set the page as the Front page in Admin>Settings>Reading it still does not work.

    If i dont set Hom epage only it all works fine.

    i was wondering if i could hardcode on line 118 of
    site-background-slider.php
    $home_page = get_option( 'sbs_homepage_url', 'http://'.$_SERVER['HTTP_HOST'] );
    to
    $home_page = get_option( 'sbs_homepage_url', 'http://www.site.com/splash/'] );

    I cant tell as for some reason i cant delete the file online or overwrite it - and i cant change the permissions for it.

  9. skashi
    Member
    Posted 1 year ago #

    There is only one thing that the homepage option cannot do which is tell that http://www.site.com/splash is the home page. If you were to have http://splash.site.com it would work.

    The problem is not the $home_page variable in question (which you can set in the back-end administration of this plugin) it is the $_SERVER['REQUEST_URI'] limitation of PHP which picks up http://www.site.com/splash as a sub directory of site.com

  10. tomwgf
    Member
    Posted 1 year ago #

    hi skashi
    so, if i set 'splash' to be the home page in wordpress settings, AND make the url for the home page http://www.site.com/, then it would work ok?

  11. skashi
    Member
    Posted 1 year ago #

    If you want to make http://www.site.com/splash the home page of your site you need to create a subdomain on your server so that it will be (for example) http://splash.site.com and this address you would enter in the Homepage URL option in the Site Background Slider plugin admin settings.

  12. tomwgf
    Member
    Posted 1 year ago #

    Hi Skashi
    sorry to repeat my self but if i set 'splash' to be the home page in wordpress settings, (so not http://www.site.com/splash, just http://www.site.com/) AND make the url for the home page http://www.site.com/, then it would work ok?

    tom

  13. way-show-er
    Member
    Posted 1 year ago #

    Hi, I have a question, and feel free to tell me to start a new topic, but I do have one that's about the custom template page.

    I created multiple custom pages, then activated the plugin - works like a charm. But then, when I edited the page... the plugin stopped working.

    I am a php noob, but is there anything I can try?

  14. Frumph
    Member
    Posted 1 year ago #

    @tomwgf - the plugin needs to be fixed to use the correct method of finding root. You do not need to change how your hosting works.

  15. skashi
    Member
    Posted 1 year ago #

    @tomwgf Yes that would work fine. Try it and let me know if you are having problems.

    @Frumph The plugin is not broken. It has just been updated to version 1.0.8 where it addresses the home page issue allowing you to enter the homepage url as an option in the Site Background Slider admin settings and the plugin will compare that url path with the current url path of a user navigating the site.

  16. Press Pixels
    Member
    Plugin Author

    Posted 1 year ago #

    As to all the home page limitation and issues - this has been updated into the latest version so you can add your own home page URL for displaying background slides only on the home page.

    Due to WordPress having multiple methods for detecting the homepage and this also not being accurate as certains themes also code there own methods - this is the only way it will work for all users. Enjoy!

  17. Frumph
    Member
    Posted 1 year ago #

    "this is the only way it will work for all users. "

    Would you like some assistance in using WordPress's conditional statements to properly associate the home page?

  18. tomwgf
    Member
    Posted 1 year ago #

    hi
    The plugin is still Version 1.0.8?

    I have Show only on Home Page ticked.
    i have Homepage Url: http://www.mysite.co.uk/site/ (site is the demo folder)

    I have tried changing the Permalinks to something more basic
    I have tried Homepage Url: http://www.mysite.co.uk/site/index.php
    and Homepage Url: http://www.mysite.co.uk/site/home
    (home being the name of the homepage)

    But it does not show. I cannot as yet test it on http://www.mysite.co.uk/
    I am hoping that will solve everything.

  19. Press Pixels
    Member
    Plugin Author

    Posted 1 year ago #

    I have tried many methods but if you believe you have a "one size fits all" solution then yes, please do tell ;)

  20. Press Pixels
    Member
    Plugin Author

    Posted 1 year ago #

    @tomwgf did you type in the homepage URL in the backend and also tick the show only homepage option? And yes the plugin latest is 1.0.8

    If it is not showing at all then try un-tick show only homepage option and check if jQuery is loading, send me your URL and I will check when it is active...

  21. Frumph
    Member
    Posted 1 year ago #

    Generally the people who have issues with is_home() not working is that they are not getting the current global $wp_query before checking any conditionals.

  22. Press Pixels
    Member
    Plugin Author

    Posted 1 year ago #

    @Frumph We tried that - that will not work if using a custom theme with a static home page. is_home() is unreliable - it does not even have to be defined in lots of themes and therefore will fail - in that case you have to use is_front_page() which also sometimes does not work.

    We had both options at one point with to many support requests saying it does not work - so now users can just type in there home page URL - and if that is matched on page load - the background slides are run. Easy Peasy no more Lemon Squeezy.

  23. tomwgf
    Member
    Posted 1 year ago #

    hi
    heres the url: http://www.hardenhuish.wilts.sch.uk/site/
    currently Show only on Home Page is unticked
    Homepage URL http://www.hardenhuish.wilts.sch.uk/site/

    thanks
    tom

  24. Press Pixels
    Member
    Plugin Author

    Posted 1 year ago #

    Cool, the code is running - try disabling your main slider (not sure if that is a plugin - nivoSlider I think) and also remove the dash "-" in your filenames, plus add 1 more image - let me know how it goes.

  25. tomwgf
    Member
    Posted 1 year ago #

    hi
    i have added a third BG pic
    i deactivated EasyNivo slider
    Show only on Home Page is now ticked
    i tried
    Homepage URL http://www.hardenhuish.wilts.sch.uk/site/
    Homepage URL http://www.hardenhuish.wilts.sch.uk/site/home
    (as that is the title of the homepage)
    Homepage URL http://www.hardenhuish.wilts.sch.uk/site/home/

    the homepage does not have '-' in the slug, it is just home

    but get nothing now.

    I have just tried Setting>Reading and deselected Home as the home page - and set it to Select - still nothing

  26. Frumph
    Member
    Posted 1 year ago #

    Here, pixel. I rewrote it for you.

    http://pastebin.com/KvQ3HCaj

    ^ remove the stray var_dump() I left in there for testing ;/ and your unnecessary option and admin stuff for people to input their url

    The issue is that is_home() does not work in 'init' or 'plugin_init' it works though after wp_head, so to use it you need to use it in the action that is going in wp_head.

  27. skashi
    Member
    Posted 1 year ago #

    @tomwgf Like I mentioned before, your url: http://www.hardenhuish.wilts.sch.uk/site/ will not work as it is a sub folder of your domain http://www.hardenhuish.wilts.sch.uk. You need to make your homepage url http://www.hardenhuish.wilts.sch.uk or http://site.hardenhuish.wilts.sch.uk for it to work

  28. tomwgf
    Member
    Posted 1 year ago #

    OK, sadly i can't do that at the moment - i'll just have to see how it goes - thanks
    tom

  29. Frumph
    Member
    Posted 1 year ago #

    @Skashi please do not tell people to change their installations just to make something work. It is the plugin author's responsibility to make things work for all possible installations.

  30. skashi
    Member
    Posted 1 year ago #

    @Frumph As I've mentioned before, PHP's $_SERVER['REQUEST_URI'] variable does not pick up a sub-directory as your homepage. Therefore if http://www.site.com/subpage is your homepage then the $_SERVER['REQUEST_URI'] variable is going to return /subpage and not the root /. There is nothing one can do about this. This is a limitation on PHP's side so if you would like to rewrite PHP then be my guest. In any case this is a server issue and has nothing to do with the plugin being coded incorrectly.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.