Archived topic
Trying to not show hooks on home page (latest posts)
30 replies · Started by itg on March 30, 2020
Hi Guys
My home page is a list of my latest posts.
I am using a hook and it is displaying on all post snippets on home page. I am using the following code above the hook html in the hook box and enabling php but hooks are still showing on all archive pages and home page.
Any ideas how i stop the hook showing, i only want the hooks to display on the actual page or post, thank you
The exact code i am using in the hook box above the hook html
<?php if ( ! is_front_page() && ! is_home() ) : ?>
This content is EXCLUDED from the latest post page
<?php endif; ?>
Hi there,
Have you tried the hooks element module?
https://docs.generatepress.com/article/hooks-element-overview/
You can use the Display rules tab so no need to write your own conditional rules:
https://docs.generatepress.com/article/hooks-element-overview/#display-rules
Let me know if this helps :)
Hi Leo, im am not really good at this stuff, i read it but never understood it.
I thought i could simply put a bit of code into the hook box but its not working.
Could i use css or does it have to be the php hook code. Tell you truth i am lost any help you can give would be appreciated, thank you
did you look at my home page leo?
Yup I did look at your home page.
Are you referring to the Chinese Antique Valuations And Appraisals section?
So you only want that to appear on the home page?
The valuation section is repeated on every post on the home page, i wish it to only show on the actual post or page and not to show on the home page or archive pages, thanks
i thought this code placed in the hook box would have stopped the hook being shown on home page and archive pages
<?php if ( ! is_front_page() && ! is_home() ) : ?>
This content is EXCLUDED from the latest post page
<?php endif; ?>
So try creating a new hook element by going to Appearance > Elements and click "Add New", from the Element dropdown list, choose "Hook".
Add your content in the hook element content box (green box) and select the desired hook (red box)
https://www.screencast.com/t/RWJfh1q0O
Then this would be your display rules:
https://www.screencast.com/t/xj41D4d8
Let me know if this helps :)
You don't need the conditional statement in the hook box.
Simply add this as the content:
<blockquote><strong>Chinese Antique Valuations And Appraisals</strong>
<br>
<br>
<em>Do you own a piece of Chinese porcelain or an oriental work of art that you would like to know more about, such as age, history and value?
<br>
<br>
Then you should really consider using our <a href="https://www.chineseantiques.co.uk/valuations-authentication-appraisals/"><strong>Chinese Antique Valuation Service</strong></a> as the last thing you want to do is risk under selling the piece due to lack of knowledge or ill gotten advice.</em></blockquote>
Hi Leo i do not have any element option, if i go to appearance there is no elements section?
Make sure Element is activated:
https://docs.generatepress.com/article/installing-gp-premium/#activate-your-modules
Hi Leo, it is activated... thanks
no options to navigate to where ever it is
Just to confirm, the Elements module is activated but you don't see Elements in Dashboard > Appearance?
If so can you send me the dashboard access preferably with all plugins disabled except GP Premium?
You can send the dashboard access using Account Issue here:
https://generatepress.com/contact/
Please include the following information:
– The URL of this topic.
– Login URL.
– Username and password.
ok all sent thanks
You are using a very old version of GP Premium:
https://www.screencast.com/t/YHjT0j0EY
The current version is 1.9.1 so please update then activate the Elements module:
https://docs.generatepress.com/article/updating-gp-premium/