Site logo

[Resolved] Trying to not show hooks on home page (latest posts)

Home Forums Support [Resolved] Trying to not show hooks on home page (latest posts)

Home Forums Support Trying to not show hooks on home page (latest posts)

  • This topic has 30 replies, 2 voices, and was last updated 6 years ago by Leo.
Viewing 15 posts - 1 through 15 (of 31 total)
  • Author
    Posts
  • #1219809
    itg

    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; ?>

    #1219917
    Leo
    Staff
    Customer Support

    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 🙂

    #1219942
    itg

    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

    #1219943
    itg

    did you look at my home page leo?

    #1219951
    Leo
    Staff
    Customer Support

    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?

    #1219956
    itg

    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

    #1219959
    itg

    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; ?>

    #1219962
    Leo
    Staff
    Customer Support

    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 🙂

    #1219964
    Leo
    Staff
    Customer Support

    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>
    #1219973
    itg

    Hi Leo i do not have any element option, if i go to appearance there is no elements section?

    #1219982
    Leo
    Staff
    Customer Support
    #1219984
    itg

    Hi Leo, it is activated… thanks

    no options to navigate to where ever it is

    #1219987
    Leo
    Staff
    Customer Support

    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.

    #1219993
    itg

    ok all sent thanks

    #1219995
    Leo
    Staff
    Customer Support

    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/

Viewing 15 posts - 1 through 15 (of 31 total)
  • You must be logged in to reply to this topic.