Month: July 2016

How to use wp_enqueue for a particular page in WordPress

if you want to add the JS file only to a specified page by wp_enqueue, you can wrap it in an is_page() condition:

add_action( 'wp_enqueue_scripts', 'load_myjs' );

function load_myjs() {
    if( is_page('your-page') ){
       wp_register_script('load_my_js',get_template_directory_uri().'/yourjsfilename.js', array('jquery'),'1.1',true);

Have any doubt, then comment here!

Parsing Domain From URL In PHP

For our customization want to parsing domain from URL in PHP then use the following code. Here $parse[‘host’] prints the domain name of a given URL in $url.

$url = '';
$parse = parse_url($url);
print $parse['host']; // prints ''

Have any doubt, then comment here!