• Resolved artandscores

    (@artandscores)


    Hi Tom,
    i need to put some text in every content-page, blog-page and post.

    I′ve been testing several of this hooks, but none of them is 100% what i want.

    https://docs.generatepress.com/collection/hooks

    “generate_after_entry_content” is almost perfect, it displays into blog-page and post, but not into content-pages.

    * also tryed pippin filter. It displays into content-pages and post,but not into blog-page.

    function pippin_filter_content_sample($content) {
    if( is_singular() && is_main_query() ) {
    $new_content = ‘<p>This is added to the bottom of all post and page content, as well as custom post types.</p>’;
    $content .= $new_content;
    }
    return $content;
    }
    add_filter(‘the_content’, ‘pippin_filter_content_sample’);

    ?Any recomendations?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Theme Author Tom

    (@edge22)

    Hi there,

    Have you tried the generate_after_content hook?: https://docs.generatepress.com/article/generate_after_content/

    Thread Starter artandscores

    (@artandscores)

    Yes, but not 100% my like

    a) “generate_after_entry_content” is almost my like. It displays into blog-page and post (showing before category folder and Leave a comment), but not into content-pages.

    b) “generate_after_content” . It displays into content-pages also blog-page and post (showing after category folder and Leave a comment – dont like this aspect-).

    Thanks.

    Theme Author Tom

    (@edge22)

    Hmm ok, back to Pippin’s function:

    function pippin_filter_content_sample( $content ) {
        if( is_main_query() ) {
            $new_content = '<p>This is added to the bottom of all post and page content, as well as custom post types.</p>';
            $content .= $new_content;
        }
        return $content;
    }
    add_filter('the_content', 'pippin_filter_content_sample');

    Can you try that?

    Thread Starter artandscores

    (@artandscores)

    Exactly, 100% my like, the “and” single() out and work perfect.

    * if ( is_main_query() ) —> goes after .entry-content of
    – single-pages +
    – blog-page +
    – posts.

    Newly you know “almost” every thing.
    Thank you sir.

    Theme Author Tom

    (@edge22)

    You’re welcome ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘G.P.child: text after entry content’ is closed to new replies.