<?php

/**

* The main template file.

*

* @package WordPress

* @subpackage Kin

*/

/**

*Get all photos

**/

$page_bg_gallery_id = get_option('pp_home_cat');

$args = array(

'post_type' => 'attachment',

'numberposts' => -1,

'post_status' => null,

'post_parent' => $page_bg_gallery_id,

'order' => 'ASC',

'orderby' => 'menu_order',

);

$bg_photo_arr = get_posts( $args );

get_header(); ?>

<?php

if(!empty($bg_photo_arr))

{

?>

<!-- Begin content -->

<div id="content_wrapper">

<?php

$pp_gallery_height = 600;

$image_index = -1;

$image_array = array(" " " "

?>

<div class="inner" style="height:<?php echo $pp_gallery_height; ?>px">

<input type="hidden" id="gallery_width" name="gallery_width" value="900"/>

<?php

foreach($bg_photo_arr as $key => $photo)

{

$image_url = $photo->guid;

$image_url = wp_get_attachment_image_src( $photo->ID, 'gallery' );

$full_image_url = wp_get_attachment_image_src( $photo->ID, 'full' );

If (strpos($full_image_url[0],”1-397x600.png”) > 0 { $image_index = 1; }

If (strpos($full_image_url[0],”2-397x600.png”) > 0 { $image_index = 2; }

If (strpos($full_image_url[0],”3-397x600.png”) > 0 { $image_index = 3; }

If (strpos($full_image_url[0],”4-397x600.png”) > 0 { $image_index = 4; }

?>

<div class="card" style="width:<?php echo intval($image_url[1]); ?>px;height:<?php echo intval($image_url[2]); ?>px;">

<a href="<?php echo $image_array[$image_index]; ?>" rel="slide">

<img src="<?php echo $image_url[0]; ?>" style="width:<?php echo intval($image_url[1]); ?>px;height:<?php echo intval($image_url[2]); ?>px;" alt=""/>

</a>

<?php

if(!empty($photo->post_title) OR !empty($photo->post_content))

{

?>

<div class="title">

<?php

$pp_gallery_title = get_option('pp_gallery_title');

if(!empty($pp_gallery_title) & !empty($photo->post_title))

{

?>

<h2<?php echo $photo->post_title?</h2>

<?php

}

?>

</div>

<?php

}

?>

</div>

<?php

}

?>

</div>

<div id="move_prev"</div>

<div id="move_next"</div>

</div>

<!-- End content -->

<br class="clear"/<br/>

<div id="content_slider_wrapper"<div id="content_slider"</div</div>

<?php

}

?>

<?php

$pp_blog_display_social = get_option('pp_blog_display_social');

if(!empty($pp_blog_display_social)):

?>

<div class="post_social">

<!-- Place this tag where you want the +1 button to render -->

<g:plusone size="medium" href="<?php echo $page->guid; ?>"</g:plusone>

<!-- Place this render call where appropriate -->

<script type="text/javascript">

(function() {

var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;

po.src = '

var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);

})();

</script>

<iframe src="// echo urlencode($page->guid); ?&amp;send=false&amp;layout=button_count&amp;width=200&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=21&amp;appId=268239076529520" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:90px; height:21px;" allowTransparency="true" class="facebook_button"</iframe>

<a href=" class="twitter-share-button" data-count="horizontal" data-text="<?php the_title(); ?>" data-url="<?php echo $page->guid; ?>">Tweet</a<script type="text/javascript" src="//platform.twitter.com/widgets.js"</script>

</div>

<br class="clear"/>

<?php

endif; ?>

<?php

$pp_homepage_music_m4a = get_option('pp_homepage_music_m4a');

$pp_homepage_music_ogg = get_option('pp_homepage_music_ogg');

$pp_homepage_music_mp3 = get_option('pp_homepage_music_mp3');

if(!empty($pp_homepage_music_m4a) & !empty($pp_homepage_music_mp3) & !empty($pp_homepage_music_ogg))

{

?>

<!-- Audio Player -->

<div id="jquery_jplayer_1"</div>

<div id="jp_interface_1">

<a href="#" class="jp-play">Play</a>

<a href="#" class="jp-pause">Pause</a>

</div>

<?php

}

?>

<script>

$j(document).ready(function() {

<?php

if(!empty($pp_homepage_music_m4a) & !empty($pp_homepage_music_mp3) & !empty($pp_homepage_music_ogg))

{

$pp_homepage_music_play_script = '';

$pp_homepage_music_play = get_option('pp_homepage_music_play');

if(!empty($pp_homepage_music_play))

{

$pp_homepage_music_play_script = '.jPlayer("play")';

}

?>

$j("#jquery_jplayer_1").jPlayer({

ready: function () {

$j(this).jPlayer("setMedia", {

mp3: "<?php echo THEMEUPLOADURL.$pp_homepage_music_mp3; ?>",

m4a: "<?php echo THEMEUPLOADURL.$pp_homepage_music_m4a; ?>",

oga: "<?php echo THEMEUPLOADURL.$pp_homepage_music_ogg; ?>",

end: ""

})<?php echo $pp_homepage_music_play_script; ?>

},

//solution: "flash, html", // Flash with an HTML5 fallback.

swfPath: "<?php echo get_stylesheet_directory_uri(); ?>/js/",

supplied: "mp3,m4a,oga"

});

<?php

}

?>

});

</script>

<?php get_footer(); ?>