</div>
								</div>
<?php 
    }
    $presentations = get_post_meta(get_the_ID(), $slideId . '_presentations', true);
    if ($presentations) {
        ?>
								<div class="skills">
									<div class="skills_title">
										<strong>presentations</strong>
									</div>
									<div class="masonry_wrapper">
										<div class="masonry_column">
<?php 
        foreach ($presentations as $presentation) {
            if (!empty($prevPresentation) && isSeparateGroup('presentations', $prevPresentation, $presentation)) {
                ?>
											<br />
										</div>
										<div class="masonry_column">
<?php 
            }
            echo '											' . displayMetaLabel('presentations', $presentation) . '<br />' . PHP_EOL;
            $prevPresentation = $presentation;
        }
        unset($prevPresentation);
        ?>
											<br />
										</div>
									</div>
								</div>
Ejemplo n.º 2
0
function slide_info_html_custom_box($post, $arguments)
{
    // Use nonce for verification.
    wp_nonce_field('work_info_field_nonce', 'work_info_noncename');
    $slideNumber = $arguments['args']['slideNumber'];
    $slideId = 'slide_' . $slideNumber;
    printf('<p><strong>%1$s</strong></p>', __('Project Slide', 'changeMe'));
    $saved = get_post_meta($post->ID, $slideId . '_url', true);
    $label = __('Enter a URL or upload an image', 'changeMe');
    if ($saved) {
        $imageUrl = $saved;
    } else {
        $imageUrl = '';
    }
    printf('<input type="text" name="' . $slideId . '_url" value="%1$s" id="' . $slideId . '_url" style="width: 100&#37;; margin-bottom: 10px;" />' . '<input type="button" value="Upload Image" class="button button-small upload_button" id="' . $slideId . '_button" />' . '<label for="' . $slideId . '_url"> %2$s </label>' . '<br /><br />', esc_attr($imageUrl), esc_html($label));
    $saved = get_post_meta($post->ID, $slideId . '_youtube_url', true);
    $label = __('Slide YouTube URL', 'changeMe');
    if ($saved) {
        $imageUrl = $saved;
    } else {
        $imageUrl = '';
    }
    printf('<input type="text" name="' . $slideId . '_youtube_url" value="%1$s" id="' . $slideId . '_youtube_url" style="width: 100&#37;; margin-bottom: 10px;" />' . '<label for="' . $slideId . '_youtube_url"> %2$s ' . '</label><br />', esc_attr($imageUrl), esc_html($label));
    echo '</p><hr>';
    printf('<p><strong>%1$s</strong></p>', __('Project Roles', 'changeMe'));
    $saved = get_post_meta($post->ID, $slideId . '_roles', true);
    global $roleGroups;
    echo '<div class="masonry_wrapper">';
    echo '<div class="masonry_column">';
    foreach ($roleGroups as $group) {
        foreach ($group as $key => $label) {
            if (!empty($prevRole) && isSeparateGroup('roles', $prevRole, $key)) {
                echo '<br />';
                echo '</div>';
                echo '<div class="masonry_column">';
            }
            if (!empty($saved)) {
                if (in_array($key, $saved)) {
                    $checked = 'checked="checked"';
                } else {
                    $checked = '';
                }
            }
            printf('<input type="checkbox" name="' . $slideId . '_roles[]" value="%1$s" id="' . $slideId . '_roles[%1$s]" %3$s />' . '<label for="' . $slideId . '_roles[%1$s]"> %2$s ' . '</label><br />', esc_attr($key), esc_html($label), $checked);
            $prevRole = $key;
            unset($checked);
        }
    }
    unset($prevRole);
    echo '</div></div><hr>';
    printf('<p><strong>%1$s</strong></p>', __('Project Disciplines', 'changeMe'));
    $saved = get_post_meta($post->ID, $slideId . '_disciplines', true);
    global $disciplineGroups;
    echo '<div class="masonry_wrapper">';
    echo '<div class="masonry_column">';
    foreach ($disciplineGroups as $group) {
        foreach ($group as $key => $label) {
            if (!empty($prevDiscipline) && isSeparateGroup('disciplines', $prevDiscipline, $key)) {
                echo '<br />';
                echo '</div>';
                echo '<div class="masonry_column">';
            }
            if (!empty($saved)) {
                if (in_array($key, $saved)) {
                    $checked = 'checked="checked"';
                } else {
                    $checked = '';
                }
            }
            printf('<input type="checkbox" name="' . $slideId . '_disciplines[]" value="%1$s" id="' . $slideId . '_disciplines[%1$s]" %3$s />' . '<label for="' . $slideId . '_disciplines[%1$s]"> %2$s ' . '</label><br />', esc_attr($key), esc_html($label), $checked);
            $prevDiscipline = $key;
            unset($checked);
        }
    }
    unset($prevDiscipline);
    echo '</div></div><hr>';
    printf('<p><strong>%1$s</strong></p>', __('Project Tools', 'changeMe'));
    $saved = get_post_meta($post->ID, $slideId . '_tools', true);
    global $toolGroups;
    echo '<div class="masonry_wrapper">';
    echo '<div class="masonry_column">';
    foreach ($toolGroups as $groups) {
        foreach ($groups as $key => $label) {
            if (!empty($prevTool) && isSeparateGroup('tools', $prevTool, $key)) {
                echo '<br />';
                echo '</div>';
                echo '<div class="masonry_column">';
            }
            if (!empty($saved)) {
                if (in_array($key, $saved)) {
                    $checked = 'checked="checked"';
                } else {
                    $checked = '';
                }
            }
            printf('<input type="checkbox" name="' . $slideId . '_tools[]" value="%1$s" id="' . $slideId . '_tools[%1$s]" %3$s />' . '<label for="' . $slideId . '_tools[%1$s]"> %2$s ' . '</label><br />', esc_attr($key), esc_html($label), $checked);
            $prevTool = $key;
            unset($checked);
        }
    }
    unset($prevTool);
    echo '</div></div><hr>';
    printf('<p><strong>%1$s</strong></p>', __('Project Products', 'changeMe'));
    $saved = get_post_meta($post->ID, $slideId . '_products', true);
    global $productGroups;
    echo '<div class="masonry_wrapper">';
    echo '<div class="masonry_column">';
    foreach ($productGroups as $group) {
        foreach ($group as $key => $label) {
            if (!empty($prevProduct) && isSeparateGroup('products', $prevProduct, $key)) {
                echo '<br />';
                echo '</div>';
                echo '<div class="masonry_column">';
            }
            if (!empty($saved)) {
                if (in_array($key, $saved)) {
                    $checked = 'checked="checked"';
                } else {
                    $checked = '';
                }
            }
            printf('<input type="checkbox" name="' . $slideId . '_products[]" value="%1$s" id="' . $slideId . '_products[%1$s]" %3$s />' . '<label for="' . $slideId . '_products[%1$s]"> %2$s ' . '</label><br />', esc_attr($key), esc_html($label), $checked);
            $prevProduct = $key;
            unset($checked);
        }
    }
    unset($prevProduct);
    echo '</div></div><hr>';
    printf('<p><strong>%1$s</strong></p>', __('Project Presentation', 'changeMe'));
    $saved = get_post_meta($post->ID, $slideId . '_presentations', true);
    global $presentationGroups;
    echo '<div class="masonry_wrapper">';
    echo '<div class="masonry_column">';
    foreach ($presentationGroups as $groups) {
        foreach ($groups as $key => $label) {
            if (!empty($prevPresentation) && isSeparateGroup('presentations', $prevPresentation, $key)) {
                echo '<br />';
                echo '</div>';
                echo '<div class="masonry_column">';
            }
            if (!empty($saved)) {
                if (in_array($key, $saved)) {
                    $checked = 'checked="checked"';
                } else {
                    $checked = '';
                }
            }
            printf('<input type="checkbox" name="' . $slideId . '_presentations[]" value="%1$s" id="' . $slideId . '_presentations[%1$s]" %3$s />' . '<label for="' . $slideId . '_presentations[%1$s]"> %2$s ' . '</label><br />', esc_attr($key), esc_html($label), $checked);
            $prevPresentation = $key;
            unset($checked);
        }
    }
    unset($prevTool);
    echo '</div></div><hr>';
    printf('<p><strong>%1$s</strong></p>', __('Description', 'changeMe'));
    $saved = get_post_meta($post->ID, $slideId . '_description', true);
    printf('<textarea name="' . $slideId . '_description" id="' . $slideId . '_description" placeholder="Enter your description here...">%1$s</textarea>' . '<br />', esc_attr($saved));
    echo '<br/>';
}