Check if the page is a node using arguments in D7 In Drupal 6, to check if current page is a node, we use the following snippet:

if (arg(0)=='node' &amp;&amp; is_numeric(arg(1))) { /* Do stuff. */ }


Since this is a frequently used statement, I wonder if there's a shorter way to do this in Drupal 7, such as something similar to the following: 

if (is_node()) { /* Do stuff. */ }
Actually, there is a function that is available in Drupal 6 too: menu_get_object(). With the default values, it will return a node object if the URL for the current page starts with node/[node ID] (where [node ID] is the node ID), and FALSE in the other cases; the function is particularly useful if, after verifying the current page is a node page, you also need to access the node object associated with the page, and the function that is calling menu_get_object() doesn't get a node object between its arguments.

In Drupal 7, there is also another function, but its purpose is just to verify if the current viewed page is the full page view of the node passed as argument: node_is_page().