Archived topic
Hook element not loading on front page
5 replies · Started by Jakob Smith on April 4, 2019
I have a hook element with some javascript, that I have set to load in wp_footer on the page that is set as front page and another page, in "Display rules".
But on the page, that is set as front page, the code is not loaded.
Here is the code:
<script type="text/javascript">
jQuery(document).ready(function($) {
$('.ab-block-cta').bind('click', function() {
window.location = $(this).find('a').attr('href');
});
});
</script>
You see it on the link provided in "Your website URL"/ydelser
But not on the front page.
How can this be?
Hi there,
i can't see the link, can you edit your original topic and re-add the Site URL. Make sure it is a valid URL as this may be getting rejected.
Just edited the original topic and added the URL where the script is visible.
In your display rules are you using the Location: Pages ?
If so can you select the Front Page instead.
Thanks, that works, along with the other page.
But when the specified frontpage-page is also selectable, others might get into the same problem.
Glad to hear that.
Yes, unfortunately the way WP works is the Front Page doesn't have a specific URL/slug hence the need for that dedicated display rule. And there isn't a way of filtering out the actual page.