/** * Regresa toda la información de las fotos de Juan Guzmán * @return JSON $infoPhotos */ function get_photos_info() { $info_photos = array(); $args_apas = array('post_type' => 'foto-jg', 'posts_per_page' => -1); $query_mapas = new WP_Query($args_apas); if ($query_mapas->have_posts()) { while ($query_mapas->have_posts()) { $query_mapas->the_post(); global $post; $lat = get_lat($post->ID); $lng = get_lng($post->ID); $lugar = get_lugar($post->ID); $fecha = get_fecha($post->ID); $decada = get_decada($post->ID); $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'thumbnail'); $info_photos[$post->post_name] = array('title' => $post->post_title, 'lat' => $lat, 'lng' => $lng, 'lugar' => $lugar, 'fecha' => $fecha, 'decada' => $decada, 'img_url' => $image[0], 'permalink' => get_permalink($post->ID)); } } wp_reset_query(); return json_encode($info_photos); }
/** * Here we add all the javascript that needs to be run on the footer. **/ function footer_scripts() { global $post; if (wp_script_is('functions', 'done')) { ?> <script type="text/javascript"> <?php if (is_home()) { ?> /*------------------------------------*\ #HOME \*------------------------------------*/ //toggleElementOnSscroll( $('header'), '.hero__text'); toggleElementOnSscroll( $('.image-bg--hero'), '.btn--map--float'); $(window).scroll(function(){ //toggleElementOnSscroll( $('header'), '.hero__text'); toggleElementOnSscroll( $('.image-bg--hero'), '.btn--map--float'); }); <?php } ?> <?php if (is_archive()) { ?> /*------------------------------------*\ #MAP \*------------------------------------*/ addAllMarkers(); <?php } ?> <?php if (is_single()) { ?> /*------------------------------------*\ #SINGLE \*------------------------------------*/ window.fbAsyncInit = function() { FB.init({ appId : '1487150328256182', xfbml : true, version : 'v2.4' }); }; (function(d, s, id){ var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/sdk.js"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); /** * Triggered events **/ // Pasar a función var lat = <?php echo get_lat(get_the_ID()); ?> ; var lng = <?php echo get_lng(get_the_ID()); ?> ; var decada = <?php echo get_decada(get_the_ID()); ?> ; var isAerial = <?php echo get_vista_aerea(get_the_ID()); ?> ; var heading = <?php echo get_heading(get_the_ID()); ?> ; showSingleMap( lat, lng, heading, isAerial, decada ); $('.js-fb-share').click( function(){ FB.ui( { method: 'share', name: '<?php echo get_the_title(); ?> ', href: '<?php echo the_permalink(); ?> ' }, function(response){ console.log( response )}); }); <?php } ?> </script> <?php } }