• Resolved qph9697

    (@qph9697)


    Hi, I am new to PHP. I am trying to add a shortcode using GP hooks, but the issue is instead of the execution result of the shortcode, the shortcode itself is displayed.

    The PHP code I am using is

    add_action( ‘generate_after_header_content’,’example_function_name’ );
    function example_function_name() {
    if ( ! is_home() ) : ?>
    echo do_shortcode(“[adsforwp id=”5306″]”);
    <?php endif;
    }

    It prints “[adsforwp id=”5306″]”.

    Please help me with this.

    Thank You.

    • This topic was modified 4 years, 9 months ago by qph9697.
    • This topic was modified 4 years, 9 months ago by qph9697.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Leo

    (@leohsiang)

    Hi there,

    Try this:

    add_action( 'generate_after_header_content', 'example_function_name' );
    function example_function_name() {
        if ( ! is_home() ) {
            echo do_shortcode( '[adsforwp id="5306"]' );
        }
    }
    Thread Starter qph9697

    (@qph9697)

    Hi, Thank You.

    The above PHP worked.

    Leo

    (@leohsiang)

    No problem ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Hook Issue’ is closed to new replies.