Archived topic
Pop up form in non static first page
10 replies · Started by Dov on October 7, 2017
Hi, I’m working with GeneratePress 1.4.3
I defined that my website first page is the one with the posts (non static).
I want to embed to this page a pop-up form, where I should embed the form code?
Thanks,
Dov
Hi there,
What is the code?
Hi Leo,
This is the code:
<script type='text/javascript' src='//form.ravpage.co.il/03564453728986cd859418c34192a42059D7903B' charset='UTF-8'></script>
That I need to embed in the page where I whant the popup form to appear
Thanks,
Dov
Hi there,
Try adding that in wp_footer hook:
https://docs.generatepress.com/article/hooks-overview/
With conditional tags like this:
<?php if ( is_page( array( '1268', '6' ) ) ) :
code here
endif; ?>
More info here: https://codex.wordpress.org/Conditional_Tags
Thanks Leo, but it doesn't work, any clue how I can embed this code in order to get popup form?
What's the exact code you've tried and can you link me to the site?
Also is there instruction on how to insert the code from where you got the code from?
Hi Leo,
According to the instructions I should embed the pop-up form code in the page code I want the pop-up appear.
But because I defined non static page, I don't know where exactly to embed this code.
<script type='text/javascript' src='//form.ravpage.co.il/03564453728986cd859418c34192a42059D7903B' charset='UTF-8'></script>
I can connect you to the site, please let me know where to send you the information in private
I really appreciate your support
As per your suggestion I tried to embed the code in this way:
wp_footer:
<?php if ( is_page( array( '1268', '6' ) ) ) :
<script type=’text/javascript’ src=’//form.ravpage.co.il/03564453728986cd859418c34192a42059D7903B’ charset=’UTF-8′></script>
The numbers 1268 and 6 are just for example. You will need to change that.
Or use the page plug method. See info here: https://codex.wordpress.org/Conditional_Tags#A_PAGE_Page
For blog page: https://codex.wordpress.org/Conditional_Tags#The_Blog_Page
Hi Leo,
I embed the code in 2 ways but I didn't get the popo-up only in the blog first page.
The 2 ways:
1. The way suggested in Wordpress CODEX:
?php if ( is_front_page() && is_home() ) {
// Default homepage
} elseif ( is_front_page() ) {
// static homepage
} elseif ( is_home() ) {
// blog page
} else {
//everything else
}:
The result is the pop-up form appear in every single page and post
2. The way you suggested:
<?php if ( is_front_page() && is_home() ) {
// Default homepage
} elseif ( is_front_page() ) {
// static homepage
} elseif ( is_home() ) {
// blog page
} else {
//everything else
}: >
The result is that the pop-up form is not showed in any page or post in the blog
What I'm doing wrong?
If you are using blog page as the front page and only want it to show on that page then try this:
<?php if ( is_front_page() && is_home() ) : ?>
code here
<?php endif; ?>