[Resolved] Text Before Post Listing At Homepage

Home Forums Support [Resolved] Text Before Post Listing At Homepage

Home Forums Support Text Before Post Listing At Homepage

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1518509
    max

    Hi. How to put text at content area before post listing at homepage?
    Please guide me

    please check screenshot

    #1518530
    Elvin
    Staff
    Customer Support

    Hi,

    You can check our Hooks Visual Guide documentation for hooks you can use to place your text:
    https://docs.generatepress.com/article/hooks-visual-guide/

    We then add the desired text using a Hook Element found on Dashboard > Appearance > Elements.
    https://docs.generatepress.com/article/hooks-element-overview/

    Example:
    https://share.getcloudapp.com/L1uQlPon

    #1518550
    max

    done
    tq

    #1519658
    Elvin
    Staff
    Customer Support

    No problem. Glad to be of any help. 🙂

    #1538459
    max

    sorry
    we had problem
    we want to appear the front page only
    no at page 2, page 3 etc

    #1538468
    Leo
    Staff
    Customer Support

    In that case you would need this PHP snippet:

    add_filter( 'generate_hook_element_display', function( $display, $element_id ) {
        if ( 123 === $element_id && is_paged() ) {
            $display = false;
        }
    
        return $display;
    }, 10, 2 );

    Adding PHP: https://docs.generatepress.com/article/adding-php/

    Replace 123 with the actual element ID.

    We will be adding this in the display rules in the next version of GP Premium 🙂

    #1541619
    max

    sorry i didn’ understand
    need to install plugin?

    #1541621
    Elvin
    Staff
    Customer Support

    sorry i didn’ understand
    need to install plugin?

    To add Leo’s PHP snippet, you either use a child theme and add the snippet on its functions.php

    Or

    If you don’t want to use a Child theme, you can install the Code Snippets plugin to be able to run the PHP snippet.

    Adding PHP:https://docs.generatepress.com/article/adding-php/

    #1541625
    max

    1) where to get child theme?
    2) and we need to activate full theme & child theme? and set primary for child theme?

    #1541631
    Elvin
    Staff
    Customer Support

    Here’s brief documentation about using child theme/s.
    https://docs.generatepress.com/article/using-child-theme/

    Note: Using a code snippet plugin maybe more practical if you have no idea how child themes work.

    Code Snippets plugin is pretty lightweight so you don’t have to worry about it adding bloat.
    https://wordpress.org/plugins/code-snippets/

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