Hi,

I need to get value of a meta from the node template. If the meta is set for the node, there's no problem and using metatag_metatags_load('node', $node->nid) works great. But if the node uses the default values, then the specific value I need is not set and I can't find how to get if.

How is this possible ?

Comments

mariacha1’s picture

Status: Active » Fixed

This worked for me:

$node = node_load($nid);
$metatags = metatag_metatags_values('node:' . $node->type, $node->metatags, array('language' => $node->language, 'token data' => array('node' => $node)));

The value of $metatags will be an array keyed off the tag names.

Depending on the location of this code, $node might already be "loaded", in which case, obviously you can skip the first line.

tahiticlic’s picture

Thanks !

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.