Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Approach 1 - create a taxonomy for each tag attribute and for each tag create an array value */
- wp_set_object_terms(123, array('dress','shoes'), tag_t1)
- wp_set_object_terms(123, array('high-waisted','high-heel'), tag_t2)
- wp_set_object_terms(123, array('topshop','next'), tag_brand)
- wp_set_object_terms(123, array('red','blue'), tag_colour)
- wp_set_object_terms(123, array('leather','suede'), tag_material)
- wp_set_object_terms(123, array('gingham','plain'), tag_pattern)
- wp_set_object_terms(123, array('42.00','50.00'), tag_price)
- wp_set_object_terms(123, array('56,79','89,84'), tag_xy)
- /* Approach 2 - create a tags taxonomy and includes a nested array of each tag and corresponding attributes */
- $tags = array(
- array(
- 't1'=>'dress',
- 't2'=>'high-waisted',
- 'brand'=>'topshop',
- 'colour'=>'red',
- 'material' => 'leather',
- 'pattern' => 'gingham',
- 'price' => '42.00',
- 'xy' => '56,79'
- ),
- array(
- 't1'=>'shoes',
- 't2'=>'high-heel',
- 'brand'=>'next',
- 'colour'=>'blue',
- 'material' => 'suede',
- 'pattern' => 'plain',
- 'price' => '50.00',
- 'xy' => '89,84'
- )
- )
- wp_set_object_terms(123,$tags,tag);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement