Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter paupau1

    (@paupau1)

    Hi,

    Thank you for the reply, I’m not good at php. I add this script in the function.php of the child theme to test and it not show hello world in post, does I need to add the id of the posts our something ? The idea is to add it to every posts.

    /**
     * Show certain scripts on certain post type/s.
     *
     * @return string The scripts for specific post types.
     */
    function hnf_custom_head_scripts() {
    	if ( 'post' === get_post_type( get_the_ID() ) ) {
    		echo '<script> Hello world </script>';
    	}
    }

    Thank you for your time,
    Regards,
    PM

    Thread Starter paupau1

    (@paupau1)

    Hi,
    I was maybe not clear :
    I want to show a script only in post (articles) but when I add the script in the post tab, it also show the script in products pages (woocommerce). Do you know how to avoid that ? I want the scriot to be show only in articles.
    Thank you for your time,
    Regards,

Viewing 2 replies - 1 through 2 (of 2 total)