Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $tag_string = '';
- for ($i = 0; $i < 8; $i++) {
- for ($j = 0; $j < 8; $j++) {
- $tag_to_use = get_post_meta($post->ID, '_tag_to_use_'.$i.'_'.$j, true);
- $tag_string = $tag_to_use ? $tag_string .= $tag_to_use . ',' : $tag_string .= '';
- }
- }
- if ( substr( $tag_string, -1) == ',' ) {
- $tag_string = rtrim( $tag_string, ',' );
- }
- echo do_shortcode( '[products tag="' . $tag_string . '"]' );
- }
- echo do_shortcode( '[products tag="' . $tag_string . '"]' );
- echo do_shortcode( '[products tag="test,test1"]' );
- $post_meta = get_post_meta($post->ID); // This returns an array with all the data in position 0, if I remember correctly
- for ($i = 0; $i < 8; $i++) {
- for ($j = 0; $j < 8; $j++) {
- if ( isset( $post_meta[0]['_tag_to_use_'.$i.'_'.$j] ) ) {
- $tag_to_use = $post_meta[0]['_tag_to_use_'.$i.'_'.$j];
- // The meta value might be in a array with the position 0, var_dump $tag_to_use to see if this is the case
- // $tag_to_use = $post_meta[0]['_tag_to_use_'.$i.'_'.$j][0];
- $tag_string = $tag_to_use ? $tag_string .= $tag_to_use . ',' : $tag_string .= '';
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement