Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I have two content types:
- post_image_on_right and post_image_wide
- post_image_on_right has three different image styles. What I would like to do is depending on what image style is being displayed give me that path or url of that image to push into a pinterest media attribute. I have a switch written but I think it's looking for a change in node type and not image style.
- switch ($node->type) {
- case 'post_image_on_right':
- $image_field = 'field_image_right';
- $image_style = 'medium';
- break;
- case 'post_image_on_right':
- $image_field = 'field_image_vertical';
- $image_style = 'medium_vertical';
- break;
- case 'post_image_on_right':
- $image_field = 'field_image_tall';
- $image_style = 'medium_tall';
- break;
- case 'post_wide_image':
- $image_field = 'field_image_wide';
- $image_style = 'large';
- break;
- }
- $field_items = field_get_items('node', $node, $image_field);
- <a class="addthis_button_pinterest" pi:pinit:url="<?php echo "http://" . $_SERVER['HTTP_HOST'] . $node_url ?>" pi:pinit:media="<?php print image_style_url($image_style, $field_items[0]['uri']); ?>" pi:pinit:layout="horizontal"></a>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement