atravelblog/functions.php
2016-09-11 16:28:51 +02:00

51 lines
1.1 KiB
PHP

<?php
add_action( 'wp_enqueue_scripts', 'td_theme_styles' );
function td_theme_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
wp_enqueue_script(
'google-maps',
'//maps.googleapis.com/maps/api/js?key=AIzaSyDHNT102YHu-TP50F78bPyvf5ia6K6cjU8&callback=initMap',
array(),
'1.0',
true
);
}
// Add google API key
function my_acf_google_map_api( $api ){
$api['key'] = 'AIzaSyDHNT102YHu-TP50F78bPyvf5ia6K6cjU8';
return $api;
}
add_filter('acf/fields/google_map/api', 'my_acf_google_map_api');
// Related posts function
function atravelblog_related_posts() {
echo('<div class="related-posts posts section-inner">');
global $post;
if ( get_the_category()[0]->name == 'Urlaub' ){
$tagebuch = get_posts(array(
'category_name' => 'Tagebuch'
));
if ($tagebuch->have_posts()) :
while ( $tagebuch->have_posts() ) : $tagebuch->the_post(); ?>
<?php global $post; ?>
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>
<?php endif; ?>
<div class="clear"></div>
<?php wp_reset_query(); ?>
</div> <!-- /related-posts --> <?php
}
}