How can I display the block only to the content types and a specific page? Created a content type.

Name: Cities we serve

Machine name: cities_we_serve

Created a page using views.

Page URL: examplesite.com/blog

Created a block. 

I would like to display the block to the above content type and the views pages. 

Edited the block as follows:



$nodeType = "Cities We Serve";

// valid node id in view mode
if ( arg(0) == 'node' AND is_numeric(arg(1)) AND arg(2) == FALSE ) {
    $node = node_load(arg(1)); // cached
    if ( ($node-&gt;type == $nodeType) OR ($node-&gt;nid == blog) ) {
        return TRUE;
    }
}
return FALSE;


Now I see the block on all pages. How can I display the block only to the content types and the blog pages?
There is another way to answer your question, without PHP in the block settings: you can use the Rules block visibility module for this. Here is a quote from its project page:


  The Rules block visibility module allows Rules components to be used to control block visibility. This provides Drupal administrators and developers extreme flexibility in controlling when blocks should be displayed on their websites, in addition to the default visibility options provided by Drupal.
  
  The general idea is that if you can do it with Rules, you can use it to control block visibility, so the possibilities are limitless.
  
  Need to show a block only for users registered more than a month ago?
  
  Perhaps you have a block that must be shown only between 8am-5pm on weekdays?
  
  What about displaying or hiding a block based on current weather conditions?
  
  All of this can be done by using Rules block visibility.


With that, and as per the "if you can do it with Rules, you can use it to control block visibility" above, you've reduced your question to making Rules "check the path of the current page" (so that the appropriate menu block is shown on the appropriate pages). And combine this with a check in such rule for your specific content type ("Cities we serve").

For an illustration of how to use this module, refer to my answer to "How to show blocks by url, when nodes have multiple paths?". It includes some Rules Components (in Rules export format), which you should replace by your variations to make it match your specific question.

To actually "determine the path structure in rules", you might want to use a Rules Condition using a regular expression. Similar to the Rules Condition in the rule I included in my answer to "How to automatically skip intermediate redirects?".

Using regular expressions opens up many more situations (on top of the Rules block visibility module) where this solution can work. If you're not familiar with Regular Expressions (not obvious ...), then maybe you also want to look at my answer to "How do I suppress a warning or error message for site users?".

Bonus:

This approach does NOT require the PHP filter to be enabled either (which you should try to avoid whenever possible) ... Refer to "PHP in database: bad practice but" for more details about this.