I have to load nodes of certain content type that are published.

Any built in function already available for this purpose?

  • 1
    What do you mean, load? What exactly do you want to do? – Patrick Kenny Apr 3 '12 at 6:21
  • @PatrickKenny, Yes, like node_load() and node_load_multiple() but have conditions on content type and published status. – Junaid Apr 3 '12 at 6:25

To load a bunch of nodes based on custom parameters, you have to use EntityFieldQuery. It replaces the $conditions array noad_load_multiple used.

  • Thanks. I was not yet experienced EntityFieldQuery, now I read about it found it as useful for this purpose. After querying I have to load node with $nodes = node_load_multiple(array_keys($result['node'])); As shown here: drupal.stackexchange.com/questions/3/… – Junaid Apr 3 '12 at 8:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.