/** * Shortcode function for Lightbox2 * * @see [lightbox name="gallery" post="1"] * @param $atts * @param null $content */ function lightbox_func($atts, $content = null) { $a = shortcode_atts(array('name' => 'lightbox', 'class' => 'lightbox'), $atts); wp_register_script('lightbox', YONK_URL . 'assets/js/lightbox.min.js', false, '2.8.2'); wp_enqueue_script('lightbox'); wp_register_style('lightbox', YONK_URL . 'assets/css/lightbox.min.css', false, '2.8.2', 'all'); wp_enqueue_style('lightbox'); if (!isset($a['post'])) { global $post; $p = $post; } else { $p = get_post(intval($a['post'])); } $image_urls = explode('~~~', Yonk_Frontend::get_meta('gallery_attachments', $p)); ob_start(); ?> <div style="position:relative;"> <div id="<?php echo $a['name']; ?> " class="<?php echo $a['class']; ?> "> <?php foreach ($image_urls as $url) { $attachment_id = get_attachment_id($url); $attachment = get_post($attachment_id); ?> <a href="<?php echo $url; ?> " data-lightbox="<?php echo $a['name']; ?> " data-title="<?php echo $attachment->post_excerpt; ?> "> <img src="<?php echo wp_get_attachment_thumb_url($attachment_id); ?> " alt="<?php echo $attachment->post_title; ?> " /> </a> <?php } ?> </div> </div> <?php return ob_get_clean(); }
<td><input class="regular-text" type="url" id="video-url" name="video-url" value="<?php echo Yonk_Frontend::get_meta($slug . '_video-url'); ?> " placeholder="http://" /></td> </tr> <tr> <th width="20%" scope="row"><label for="director">Director</label></th> <td><input class="regular-text" type="text" id="director" name="director" value="<?php echo Yonk_Frontend::get_meta($slug . '_director'); ?> " /></td> </tr> <tr> <th width="20%" scope="row"><label for="release-date">Release Date</label></th> <td><input class="regular-text" type="date" id="release-date" name="release-date" value="<?php echo Yonk_Frontend::get_meta($slug . '_release-date'); ?> " /></td> </tr> <tr> <th width="20%" scope="row"><label for="poster">Poster</label></th> <td><input class="regular-text" type="text" id="poster" name="poster" value="<?php echo Yonk_Frontend::get_meta($slug . '_poster'); ?> " /> <input class="button metabox-media" id="poster_button" name="poster_button" type="button" value="Upload" /></td> </tr> </table>
Yonk_Frontend::query('post', array('orderby' => 'title', 'order' => 'DESC'), function () { ?> <article id="post-<?php the_ID(); ?> " <?php post_class(); ?> > <div class="row"> <div class="col-lg-3"> <?php if (has_post_thumbnail()) { the_post_thumbnail(); } ?> </div> <div class="col-lg-9"> <h3><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h3> <p class="date"><?php the_date(); ?> </p> <?php the_excerpt(); ?> </div> </div> </article> <?php });