Example #1
0
                    <div class="line clearfix">
                        <figure class="col-img"><img src="<?php 
        echo $img_url;
        ?>
" alt="<?php 
        echo $img_alt;
        ?>
"/></figure>
                        <div class="entry-content">
                            <h2><?php 
        the_title();
        ?>
</h2>
                            <div class="excerpt-content show-more-hide"><?php 
        get_my_excerpt(30, $post_id, true);
        ?>
</div>
                            <div class="full-content show-more-target"><?php 
        the_content();
        ?>
</div>
                            <span class="load-more" data-lang="fr">More</span>
                        </div>
                    </div>

                <?php 
    }
}
wp_reset_postdata();
?>
Example #2
0
		str += "<img src='" + icons[i] + "' width='15' height='15'><div class='desc-label'>" + desc[i] + "</div>";
	}
	
	document.getElementById('desc').innerHTML = str;
</script>
<div id="map" style="width: 100%; height: 350px; margin-bottom: 2.5%;"></div>

<script>
	var locations = [
<?php 
$my_wp_query = new WP_Query();
$locations = $my_wp_query->query(array('post_type' => 'post', 'posts_per_page' => -1, 'cat' => $cat, 'order' => 'ASC', 'orderby' => 'title'));
foreach ($locations as $location) {
    $id = $location->ID;
    $title = trim($location->post_title);
    $excerpt = get_my_excerpt($location->post_content);
    $type = get_post_meta($id, 'projekttyp', true)[0] - 1;
    //get first selected. subtract 1, icons array are zero based.
    $mapurl = get_post_meta($id, 'kartlank', true);
    $image = wp_get_attachment_image_src(get_post_thumbnail_id($location->ID), 'single-post-thumbnail')[0];
    if (!empty($mapurl['lat'])) {
        $lat = $mapurl['lat'];
        $lng = $mapurl['lng'];
        $bg = "style=\"background-image: url(" . $image . ");background-position: center center;background-size: cover;width: 150px;height: 150px;\"";
        echo "['<div {$bg} title=\"{$excerpt}\"><div class=\"label\"><a href=\"" . get_permalink($id) . "\">" . $title . "</a></div></div>', " . $lat . ", " . $lng . ", " . $type . "], \n";
    }
}
?>
];
showLocations(locations);  
</script>