Archived topic
Exclude hook on 1 page
9 replies · Started by Alan on November 15, 2017
Hi lads,
I have had the slider on my website excluded from loading on my contact page
but I have changed something and now it is INCLUDED.
Using GP Premium 1.4.3
Here is the code
<?php if ( ! is_page( 35 ) ) : ?>
[huge_it_slider id="3"]
<?php endif; ?>
<div class="hook-slider">
<huge_it_slider id="3">
</div>
<?php if ( ! is_page( 35 ) ) : ?>
<div class="hook-logos">
Payments accepted with
</div>
<div class="hook-logos">
<img src="http://-.biz/wp-content/uploads/2017/11/Bitcoin_logo.jpg">
<img src="http://-.biz/wp-content/uploads/2017/11/Byteball-logo.jpg">
<img src="http://-.biz/wp-content/uploads/2017/11/phore-logo.jpg">
<img src="http://-.biz/wp-content/uploads/2017/11/pivx-logo.jpg">
</div>
<?php endif; ?>
Hi there,
Looks like you added the slider twice and one of them is not wrapped in the <?php if ( ! is_page( 35 ) ) : ?> statement?
hi again Leo,
yea ive been getting a bit bogged down with the little bit of code I'm trying to impliment.
ok i have it simplified now but still no joy . . .
<?php if ( ! is_page( 10 ) ) : ?>
<div class="hook-slider3">
[huge_it_slider id="3"]
</div>
<?php endif; ?>
<div class="hook-logos-text">
Payments accepted with
</div>
<div class="hook-logos">
<img src="http://-.biz/wp-content/uploads/2017/11/Bitcoin_logo.jpg">
<img src="http://-.biz/wp-content/uploads/2017/11/Byteball-logo.jpg">
<img src="http://-.biz/wp-content/uploads/2017/11/phore-logo.jpg">
<img src="http://-.biz/wp-content/uploads/2017/11/pivx-logo.jpg">
</div>
so you don't want it on front page?
Try this instead: <?php if ( ! is_front_page() ) : ?>
hi leo, no i want to exclude it from the contact page
?page_id=35
i have added the page number
<?php if ( ! is_page( 35 ) ) : ?>
<div class="hook-slider3">
[huge_it_slider id="3"]
</div>
<?php endif; ?>
Did you check execute PHP?
O M G
apologies Leo,
clicking the little box to "execute PHP"
really does help in these matters.
Apologies for the wild goose chase.
A
No problem :)
Glad you figured out!
Is it possible to exclude the same items from more than one page in the same snippet?
Yup of course. Check this: https://codex.wordpress.org/Conditional_Tags#A_Single_Post_Page