-
AuthorPosts
-
August 6, 2015 at 5:33 pm #484053
Hello,
I am trying to load my custom plugin I have made only on the frontpage of my site. The issue is when I try to load it ether via page ID or by is_home() it will not work. For some reason the ID of the home page is always returned as 0 or “false”.
Here is how I am getting the page id.
$url = explode(‘?’, ‘http://’.$_SERVER[“HTTP_HOST”] . $_SERVER[“REQUEST_URI”]);
$ID = url_to_postid($url[0]);Is there any recommendations you have that could help me with this. I am also running WPML, and only want the plugin to load on the primary home page not any of its translations, not sure if there is a way to do that or not.
August 6, 2015 at 8:19 pm #484136Hey vortexvalves!
If your using a static page in Dashboard > Settings > Reading then try this.
if ( is_home() || is_front_page() ) { }
Regards,
ElliottAugust 6, 2015 at 9:43 pm #484178this does not work, but was worth a try. To be a little more detailed, we are using a page from the enfold settings. So the theme is overriding the wordpress settings, I do not understand where or how.
We set the page in Enfold Theme > Theme Options
Frontpage Settings: and we set the static page here.Is there a way to know what is being referenced here for the themes settings page? I just need to know a way to reference this in the php code.
If there is any other suggestions that would be wonderful.
Thank you
- This reply was modified 9 years, 4 months ago by Vortex Global.
August 7, 2015 at 3:20 pm #484559Hi!
I’m sorry but I do not know what your trying to do. Perhaps something in the index.php file is what your looking for.
The is_home() and is_front_page() should be working though. Where are you using them?
Also, it would be best not to use a static page in Dashboard > Settings > Reading. You just need to set the front page in Dashboard > Enfold > Theme Options.
Best regards,
Elliott- This reply was modified 9 years, 4 months ago by Elliott.
August 7, 2015 at 5:12 pm #484622Got it figure out, I was hooking into the wrong action.
I just wasn’t sure due to the theme setting its on frontpage, which is how we have it set up.
Thank you for you time
August 10, 2015 at 4:54 am #485019 -
AuthorPosts
- The topic ‘Frontpage ID’ is closed to new replies.