Advertisement
Guest User

Untitled

a guest
Feb 16th, 2014
390
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 18.51 KB | None | 0 0
  1. <?php $memorial_template = get_post_meta( get_the_ID(), 'memorial_template', true );
  2. $img = get_field('memorial_photo');
  3. if(!$img){
  4.  $img =$template_uri.'/images/placeholder.png';
  5. }
  6.  
  7.  
  8. $post_id = get_the_ID();
  9. $args = array(
  10.   'post_type' => 'tribute',
  11.   'meta_key' => 'memorial_id',
  12.   'meta_value' => (string)$post_id
  13. );
  14.  
  15. // get results
  16. $the_query = new WP_Query( $args );
  17.  
  18.  
  19. if ( isset( $_POST['html-upload'] ) && !empty( $_FILES ) ) {
  20.  
  21.     $type = $_FILES['async-upload']['type'];
  22.     if ( preg_match( '#^image#', $type ) || preg_match( '#^audio#', $type ) ) {
  23.       require_once(ABSPATH . 'wp-admin/includes/admin.php');
  24.       $id = media_handle_upload('async-upload', $post_id); //post id of Client Files page
  25.       unset($_FILES);
  26.       if ( is_wp_error($id) ) {
  27.           $errors['upload_error'] = $id;
  28.           $id = false;
  29.       }
  30.       add_post_meta(  $id , 'user_gallery', $post_id , true ) || update_post_meta(   $id , 'user_gallery', $post_id  );
  31.       if (@$errors) {
  32.           echo '<p>'.$errors['upload_error'].'</p>';
  33.       } else {
  34.          
  35.           wp_redirect( get_permalink($post_id) );
  36.           exit();
  37.       }
  38.     }else{
  39.       echo "<p>Only images are accepted.</p>";
  40.     }
  41. }
  42.  
  43. if ( isset( $_POST['embed-submit']) ) {
  44.  
  45. }
  46.  
  47. $galargs = array(
  48.   'post_parent' => $post_id,
  49.   'post_type' => 'attachment',
  50.   'post_mime_type' => 'image',  
  51.   'meta_key' => 'user_gallery',
  52.   'meta_value' => (string)$post_id,
  53.   'post_status' => 'inherit',
  54.   'orderby' => 'date',
  55.   'order' => 'ASC'
  56. );
  57.  
  58. // get results
  59. $the_galquery = new WP_Query( $galargs );
  60.  
  61.  
  62. $audioargs = array(
  63.   'post_parent' => $post_id,
  64.   'post_type' => 'attachment',
  65.   'post_mime_type' => 'audio',  
  66.   'meta_key' => 'user_gallery',
  67.   'meta_value' => (string)$post_id,
  68.   'post_status' => 'inherit',
  69.   'orderby' => 'date',
  70.   'order' => 'ASC'
  71. );
  72.  
  73. // get results
  74. $the_audioquery = new WP_Query( $audioargs );
  75.  
  76. $vidargs = array(
  77.   'post_type' => '_user_video',
  78.   'meta_key' => 'memorial_id',
  79.   'meta_value' => (string)$post_id,
  80.   'post_status' => 'publish'
  81. );
  82.  
  83. // get results
  84. $the_vidquery = new WP_Query( $vidargs );
  85.  
  86. ?>
  87. <!DOCTYPE html>
  88.  
  89. <html>
  90. <head>
  91.     <title><?php the_field('first_name'); ?> <?php the_field('last_name'); ?>
  92.     memorial</title>
  93.     <!--[if IE]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
  94.     <link href="<?php echo $template_uri; ?>/css/template<?php echo (empty($memorial_template) ? '1' :$memorial_template)?>.css" rel="stylesheet"
  95.     type="text/css">
  96.       <link href="<?php echo $template_uri; ?>/css/jquery.fancybox.css" rel="stylesheet"
  97.     type="text/css">
  98.      <link href="<?php echo $template_uri; ?>/css/jplayer.blue.monday.css" rel="stylesheet"
  99.     type="text/css">
  100.    
  101. </head>
  102.  
  103. <body>
  104.     <div id="wrapper">
  105.         <div id="memorialheader">
  106.              <div id="headmenu">
  107.             <a href='../../'>Home</a>|<a href='../../create-memorial/'>Edit Memorial</a>|<?php echo do_shortcode('[wp-modal-login login_text="login" logout_text="logout"]') ?>
  108.   <!--audio--><div id="audioplayer">
  109.                 <div id="jquery_jplayer_1" class="jp-jplayer"></div>
  110.                 <div id="jp_container_1" class="jp-audio" style='float:right'>
  111.                     <div class="jp-type-single">
  112.                         <div class="jp-gui jp-interface">
  113.                             <ul class="jp-controls">
  114.                                
  115.                                 <!-- comment out any of the following <li>s to remove these buttons -->
  116.                                 <li><a href="javascript:;" class="jp-previous" tabindex="1">previous</a></li>
  117.                                 <li><a href="javascript:;" class="jp-play" tabindex="1">play</a></li>
  118.                                 <li><a href="javascript:;" class="jp-pause" tabindex="1">pause</a></li>
  119.                                 <li><a href="javascript:;" class="jp-stop" tabindex="1">stop</a></li>
  120.                                 <li><a href="javascript:;" class="jp-next" tabindex="1">next</a></li>
  121.                                 <li><a href="javascript:;" class="jp-mute" tabindex="1" title="mute">mute</a></li>
  122.                                 <li><a href="javascript:;" class="jp-unmute" tabindex="1" title="unmute">unmute</a></li>
  123.                                 <!--<li><a href="javascript:;" class="jp-volume-max" tabindex="1" title="max volume">max volume</a></li>-->
  124.                             </ul>
  125.                            
  126.                             <!-- you can comment out any of the following <div>s too -->
  127.                            
  128.                             <div class="jp-progress">
  129.                                 <div class="jp-seek-bar">
  130.                                     <div class="jp-play-bar"></div>
  131.                                 </div>
  132.                             </div>
  133.                                      
  134.                         </div>
  135.                         <div class="jp-title"></div>
  136.                         <div class="jp-no-solution">
  137.                             <span>Update Required</span>
  138.                             To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
  139.                         </div>
  140.                     </div>
  141.                 </div>
  142.               </div><!--audio-->
  143.             </div>
  144.              <div id="frame">
  145.               <div id="headimage">
  146.              <?php
  147.  
  148.               /*
  149.                *  Show selected image
  150.                *  Return value = URL
  151.                */
  152.  
  153.                ?>
  154.                 <img src='<?php echo $img ?>' alt="" width='150', height='150'/>
  155.             </div>
  156.             </div>
  157.            
  158.             <div id="temp_title">
  159.               <h1><p><?php the_field('first_name'); ?>
  160.               <?php the_field('last_name'); ?>
  161.               <br><br>
  162.               <?php $dateOfBirth  = DateTime::createFromFormat('Ymd', get_field('Date_of_Birth'));
  163.                 $dateOfPassing  = DateTime::createFromFormat('Ymd', get_field('date_of_passing'));?>
  164.               <?php echo $dateOfBirth->format('Y'); ?> to <?php echo $dateOfPassing->format('Y'); ?></p>
  165.              
  166.               </h1><!-- .header-->
  167.             </div>        
  168.         </div><!-- <div id="navigation">
  169.             <p>This is the Menu</p>
  170.         </div>-->
  171.  
  172.         <div id="contentwrapper">
  173.             <div id="contentliquid">
  174.                 <div id="content">
  175.                     <div class="container">
  176.                         <ul class="tabs">
  177.                             <li><a href="#tab1">About</a></li>
  178.  
  179.                             <li><a href="#tab2">Their Life</a></li>
  180.  
  181.                             <li><a href="#tab3">Gallery</a></li>
  182.  
  183.                             <li><a href="#tab4">Stories</a></li>
  184.                         </ul>
  185.  
  186.                         <div class="tab_container">
  187.                             <div class="tab_content" id="tab1">
  188.                                 <h3>About <?php the_field('first_name'); ?>
  189.                                 <?php the_field('last_name'); ?></h3>
  190.                                  
  191.                                   <?php $dateOfBirth  = DateTime::createFromFormat('Ymd', get_field('Date_of_Birth'));
  192.                                   $dateOfPassing  = DateTime::createFromFormat('Ymd', get_field('date_of_passing'));?>
  193.                                 <br/>
  194.                                 Born on <?php echo $dateOfBirth->format('d/m/Y'); ?>
  195.                                 <br/>
  196.                                 passed on <?php echo $dateOfPassing->format('d/m/Y'); ?>
  197.                                 <br/>
  198.                             <?php the_field('loved_one_details'); ?>
  199.  
  200.                                    <p><h2>Memorial Tributes</h2></p>
  201.        
  202.                              
  203.                          
  204.                             <?php if( $the_query->have_posts() ): ?>
  205.                      
  206.                               <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
  207.                                 <div style='background:#fff; margin-bottom:10px;'>
  208.                                     <div><?php the_time('F jS, Y') ?></div>
  209.                                     <div><?php the_content(); ?> <br/>from <?php the_author(); ?></div>
  210.                                    
  211.                                  </div>
  212.                               <?php endwhile; ?>
  213.                             <?php endif; ?>
  214.                              
  215.                             <?php wp_reset_query();  // Restore global post data stomped by the_post(). ?>
  216.                            
  217.                          
  218.                           <?php if ( is_user_logged_in() ): ?>
  219.                           <h3>Add tribute</h3>
  220.                              <form method='post'>
  221.                                     <textarea name='copy' rows="4" cols="50"></textarea>
  222.                                     <input type='hidden' name='post_id' value='<?php echo get_the_ID()?>'/>
  223.                                     <input type='submit' name='submit_tribute' value='submit'/>
  224.                                    </form>
  225.                            
  226.                           <?php  endif ?>
  227.                           </div>
  228.                           <div class="tab_content" id="tab2">
  229.                                 <h2>Their Life</h2>
  230.  
  231.                                 <p><?php the_field('about_thier_life'); ?></p>
  232.                             </div>
  233.  
  234.                             <div class="tab_content" id="tab3">
  235.                                 <h2>Gallery</h2>
  236.                            
  237.                             <?php if(get_field('gallery')):?>
  238.                                 <?php foreach (get_field('gallery') as $gal ):?>
  239.                                     <a class="fancybox" rel="gallery1" href="<?php echo $gal['url']?>" title="<?php echo $gal['caption'] ?>"><img src="<?php echo $gal['sizes']['thumbnail']?>" alt="" /></a>
  240.                                 <?php endforeach ?>
  241.                             <?php endif; ?>  
  242.                            
  243.                             <?php if( $the_galquery->have_posts() ): ?>
  244.                      
  245.                               <?php while ( $the_galquery->have_posts() ) : $the_galquery->the_post(); ?>
  246.                             <a class="fancybox" rel="gallery1" href="<?php echo wp_get_attachment_url( get_the_ID()); ?>" ><?php echo wp_get_attachment_image( get_the_ID(), 'thumbnail'); ?></a>
  247.                               <?php endwhile; ?>
  248.                             <?php endif; ?>
  249.  
  250.                             <?php if ( !(get_field('gallery')) && !($the_galquery->have_posts() ) ):?>
  251.                             <p>No Gallery images added</p>
  252.                           <?php endif ?>
  253.                          
  254.                           <h2 style='clear:both'>Videos</h2>
  255.                           <!-- Video loop -->
  256.                          
  257.                            <?php if( $the_vidquery->have_posts() ): ?>
  258.                               <?php while ( $the_vidquery->have_posts() ) : $the_vidquery->the_post(); ?>
  259.                              
  260.                                <a class="fancybox-media" rel="gallery1" href="<?php echo get_post_meta(  get_the_ID(), 'video' , 'true'); ?>" ><img width='150' src="<?php echo get_post_meta(  get_the_ID(), 'image_url' , 'true'); ?>"></a>
  261.                               <?php endwhile; ?>
  262.                             <?php endif ?>
  263.                             <!-- end if -->
  264.                              <?php if ( is_user_logged_in() ): ?>
  265.                                 <form  style='clear:both' id="file-form" enctype="multipart/form-data" action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="POST">
  266.                                   <p>Add image or mp3</p>
  267.                                   <p id="async-upload-wrap"><label for="async-upload">upload</label>
  268.                                   <input type="file" id="async-upload" name="async-upload"> <input type="submit" value="Upload" name="html-upload"></p>
  269.  
  270.                                   <p><input type="hidden" name="post_id" id="post_id" value="<?php echo $post_id ?>" />
  271.                                   <?php wp_nonce_field('client-file-upload'); ?>
  272.                                   <input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>" /></p>
  273.  
  274.                                   <p><input type="submit" value="Save all changes" name="save" style="display: none;"></p>
  275.                                 </form>
  276.                                
  277.                                 <form  style='clear:both' id="embed-form"  method="POST" enctype='multipart/form-data'>
  278.                                   <p>Add video to gallery</p>
  279.                                   <label for="embed">YouTube / vimeo url:</label>
  280.                                   <textarea id='embed' name="embed"></textarea>
  281.                                   <input name='submit_video' type="submit" value="submit" onclick="MakeLinkSafe()" >
  282.                                   <p>
  283.                                     <input type="hidden" name="post_id" id="post_id" value="<?php echo $post_id ?>" />
  284.                                   <input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>" /></p>
  285.                                 </form>
  286.                               <?php endif?>
  287.                             </div>
  288.  
  289.                             <div class="tab_content" id="tab4">
  290.                                 <h2>Stories</h2>
  291.  
  292.                                 <p><?php comments_template( '', true ); ?></p>
  293.                             </div>
  294.                         </div><br clear="left">
  295.                     </div>
  296.                 </div>
  297.             </div>
  298.  
  299.             <div id="rightcolumn">
  300.              <p>Invite your family and friends
  301.              to Visit This Memorial</p>
  302.               invite_friends()
  303.              <p>Recive email and notification
  304.              when this memorial update</p>
  305.              
  306.                          <!--slider starts-->
  307.              <!-- Start Photo Slider -->
  308. <?php if( $the_galquery->have_posts() ): ?>
  309.  
  310. <?php while ( $the_galquery->have_posts() ) : $the_galquery->the_post(); ?>
  311. <a class="fancybox" rel="gallery1" href="<?php echo wp_get_attachment_url( get_the_ID()); ?>" ><?php echo wp_get_attachment_image( get_the_ID(), 'thumbnail'); ?></a>
  312. <?php endwhile; ?>
  313. <?php endif; ?>
  314.  
  315. <div id="slider" class="flexslider">
  316.   <ul class="slides">
  317.     <?php foreach( $gallery_images as $gallery_image ): ?>
  318.       <li>
  319.         <img src="<?php echo $gallery1_image['url']; ?>" alt="<?php echo $gallery1_image['alt']; ?>" />
  320.       </li>
  321.     <?php endforeach; ?>
  322.   </ul>
  323. </div>
  324. <?php
  325.  
  326. /*
  327. *  The following code creates the thumbnail navigation
  328. */
  329.  
  330. ?>
  331. <div id="carousel" class="flexslider">
  332.   <ul class="slides">
  333.     <?php foreach( $gallery_images as $gallery_image ): ?>
  334.       <li>
  335.         <img src="<?php echo $gallery1_image['sizes']['thumbnail']; ?>" alt="<?php echo $gallery1_image['alt']; ?>" />
  336.       </li>
  337.     <?php endforeach; ?>
  338.   </ul>
  339. </div>
  340. <div id="single-gallery1-image">
  341.   <?php the_post_thumbnail('full'); ?>
  342. </div>
  343.  
  344. <!-- End Photo Slider -->
  345.  
  346.              </div>
  347.         </div>
  348.  
  349.         <div id="footer">
  350.             <div id="footerlogo">
  351.             <img height="50" src=
  352.             "<?php echo $template_uri; ?>/images/logo%20(1).png"
  353.             width="160">
  354.             </div>
  355.             <div id="footmenu">
  356.             <a href='../../'>Home</a>|<a href='../../create-memorial/'>Edit Memorial</a><a href='../../account-4/'>Edit account</a>|<?php echo do_shortcode('[wp-modal-login login_text="login" logout_text="logout"]') ?>
  357.             </div>
  358.         </div>
  359.     </div>
  360.  
  361.     <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
  362.     <script src="<?php echo $template_uri; ?>/js/jquery.fancybox.js"></script>
  363.  
  364.     <script src="<?php echo $template_uri; ?>/js/helpers/jquery.fancybox-media.js"></script>
  365.       <script src="<?php echo $template_uri; ?>/js/jquery.jplayer.min.js"></script>
  366.       <script src="<?php echo $template_uri; ?>/js/jplayer.playlist.min.js"></script>
  367.     <script type="text/javascript">
  368.  
  369.     $(document).ready(function() {
  370.  
  371.     $(".fancybox").fancybox({
  372.         openEffect  : 'none',
  373.         closeEffect : 'none'
  374.     });
  375.  
  376.     $('.fancybox-media').fancybox({
  377.     openEffect  : 'none',
  378.     closeEffect : 'none',
  379.     helpers : {
  380.       media : {}
  381.     }
  382.   });
  383.     //Default Action
  384.     $(".tab_content").hide(); //Hide all content
  385.     $("ul.tabs li:first").addClass("active").show(); //Activate first tab
  386.     $(".tab_content:first").show(); //Show first tab content
  387.      
  388.     //On Click Event
  389.     $("ul.tabs li").click(function() {
  390.         $("ul.tabs li").removeClass("active"); //Remove any "active" class
  391.         $(this).addClass("active"); //Add "active" class to selected tab
  392.         $(".tab_content").hide(); //Hide all tab content
  393.         var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
  394.         $(activeTab).fadeIn(); //Fade in the active content
  395.         return false;
  396.     });
  397.  
  398.  
  399.     });
  400.  
  401.     function trim(str, chars) {  
  402.     return ltrim(rtrim(str, chars), chars);  
  403. }  
  404.  
  405. function ltrim(str, chars) {  
  406.     chars = chars || "\\s";  
  407.     return str.replace(new RegExp("^[" + chars + "]+", "g"), "");  
  408. }  
  409.  
  410. function rtrim(str, chars) {  
  411.     chars = chars || "\\s";  
  412.     return str.replace(new RegExp("[" + chars + "]+$", "g"), "");  
  413. }  
  414.  
  415. function MakeLinkSafe(){  
  416.     var e = document.getElementById('embed')  
  417.     str = trim(e.value);  
  418.     if(str.substr(0, 7) == 'http://'){  
  419.         e.value = str.substr(7);  
  420.     }  
  421.     return true;  
  422. }  
  423.     </script>
  424.  
  425.    
  426.     <script>
  427. playlist =  new jPlayerPlaylist({
  428.     jPlayer: "#jquery_jplayer_1",
  429.     cssSelectorAncestor: "#jp_container_1"
  430.     },
  431.     {
  432.     swfPath: "../js",
  433.     supplied: "webmv, ogv, m4v",
  434.     smoothPlayBar: true,
  435.     keyEnabled: true
  436.     });
  437.  
  438.    
  439.  
  440.  <?php if( $the_audioquery->have_posts() ): ?>
  441.     <?php while ( $the_audioquery->have_posts() ) : $the_audioquery->the_post(); ?>
  442.    
  443.       playlist.add({
  444.        title:"<?php the_title()?>",
  445.       mp3:" <?php echo wp_get_attachment_url( $post->ID ); ?>"
  446.   });
  447.  
  448.    
  449.     <?php endwhile; ?>
  450.   <?php endif ?>
  451.     $("#jquery_jplayer_1").jPlayer("play");
  452.     </script>
  453. </body>
  454. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement