Beispiel #1
0
/**
 * Inserts HTML for meta box, including all existing attachments
 *
 * @return void
 * @author Jonathan Christopher
 */
function attachments_add()
{
    ?>

    <div id="attachments-inner">

        <?php 
    $media_upload_iframe_src = "media-upload.php?type=image&TB_iframe=1";
    $image_upload_iframe_src = apply_filters('image_upload_iframe_src', "{$media_upload_iframe_src}");
    ?>

                <ul id="attachments-actions">
                    <li>
                        <a id="attachments-thickbox" href="media-upload.php?type=image&amp;TB_iframe=1&amp;width=640&amp;height=1500&amp;attachments_thickbox=1" title="Attachments" class="button button-highlighted">
                            <?php 
    _e('Attach', 'attachments');
    ?>
                        </a>
                    </li>
                </ul>

                <div id="attachments-list">
                    <input type="hidden" name="attachments_nonce" id="attachments_nonce" value="<?php 
    echo wp_create_nonce(plugin_basename(__FILE__));
    ?>
" />
                    <ul>
                        <?php 
    if (!empty($_GET['post'])) {
        // get all attachments
        $existing_attachments = attachments_get_attachments(intval($_GET['post']));
        if (is_array($existing_attachments) && !empty($existing_attachments)) {
            foreach ($existing_attachments as $attachment) {
                // TODO: Better handle this when examining Handlebars template
                if (empty($attachment['title'])) {
                    $attachment['title'] = ' ';
                }
                if (empty($attachment['caption'])) {
                    $attachment['caption'] = ' ';
                }
                attachments_attachment_markup($attachment['name'], $attachment['title'], $attachment['caption'], $attachment['id'], $attachment['order']);
            }
        }
    }
    ?>
            </ul>
        </div>
    </div>
    <script id="attachment-template" type="text/x-handlebars-template">
        <?php 
    attachments_attachment_markup();
    ?>
    </script>
<?php 
}
<?php

/**
 * @package _s
 * @since _s 1.0
 */
$attachments = attachments_get_attachments();
foreach ($attachments as &$attachment) {
    $attachment = (object) $attachment;
}
?>

<article id="post-<?php 
the_ID();
?>
" <?php 
post_class();
?>
>

	<div class="entry-content">
		<div class="series-head row">
			<div class="series-description span4">
				<header class="entry-header">
					<h1 class="entry-title"><?php 
the_title();
?>
</h1>

				</header><!-- .entry-header -->
				<?php