• I am just trying to find out, why the Tags do not work as supposed to inside this template. I will post the archive.php and functions.php code, so somebody can hopefully point me into the right direction to make Tags work.

    archive.php code:

    <?php
    
    $oCategory = get_queried_object();
    $bReport = in_array($oCategory->term_id, nr_get_report_category_ids());
    
    if ($bReport) {
        $aCategories = nr_get_report_categories();
        $aCategoryIDs = nr_get_report_category_ids();
    } else {
        $aCategories = nr_get_news_categories();
        $aCategoryIDs = nr_get_news_category_ids();
    }
    
    $aArgs = array(
         'nopaging' => true
        ,'category' => $oCategory->term_id
    );
    $aPosts = get_posts($aArgs);
    $aLatestPosts = get_posts(array(
        'category' => implode(',', $aCategoryIDs)
    ));
    global $aPaginatorData;
    list($aPosts, $aPaginatorData) = nat_calculate_pagination($aPosts, 10);
    
    get_header();
    
    ?>
    
    <!-- container -->
    <div class="container" style="margin-top: 20px;">
    
        <!-- breadcrumb -->
        <div class="contentblock">
            <ul class="offset1 breadcrumb">
                <li><a title="Natürlich Reisen" href="/">Natürlich Reisen</a> <span class="divider">></span></li>
                <?php
                    if ($bReport) {
                        $oReiseberichte = get_page_by_title('Reiseberichte');
                        echo '<li><a href="' . get_permalink($oReiseberichte->ID) . '">Reiseberichte</a> <span class="divider">></span></li>';
                    } else {
                        echo '<li><a href="' . get_blog_url() . '">Blog</a> <span class="divider">></span></li>';
                    }
                ?>
                <li class="active"><?php single_cat_title(); ?></li>
            </ul>
        </div>
        <!-- /breadcrumb -->
    
        <div class="container blog">
            <h2><?php echo $bReport ? 'Reiseberichte' : 'Blog'; ?></h2>
    
            <div class="tabLeftContent">
                <div id="blog">
    
    		<div class="categorydescription"><?php echo category_description( $category_id ); ?></div>
    
                    <?php foreach ($aPosts as $oPost) { global $post; $post = $oPost; ?>
                        <div class="post">
    
                            <h3>
                                <a href="<?php the_permalink() ?>"><?php the_title(); ?></a>
                            </h3>
    
                            <div class="blogmeta">
                                <span class="date"><i class="icon-time icon"></i><?php the_time('d.m.Y'); ?> </span>
                                <span class="category"><i class="icon-tag icon"></i>
                                    <?php
                                        $category = get_the_category();
    
                                        if (isset($category[0])) {
                                            echo sprintf(
                                                '<a href="%s">%s</a>',
                                                get_category_link($category[0]->cat_ID),
                                                $category[0]->name
                                            );
                                        }
                                    ?>
                                </span>
                            </div>
                            <span class="hide_on_mobile">
                            <?php
                                if (has_post_thumbnail()) {
                                    the_post_thumbnail();
                                }
                            ?>
                            </span>
                            <p>
                                <?php
                                    if (get_field('teaser')) {
                                        echo get_field('teaser');
                                    }
                                    else {
                                        the_excerpt();
                                    }
                                ?>
                            </p>
                            <a href="<?php the_permalink() ?>" class="more">&rsaquo; Weiterlesen</a>
                        </div>
                    <?php } ?>
    
                    <div class="contentblock pagination">
                        <?php echo nat_make_paginator_page_html($aPaginatorData); ?>
                    </div>
    
    <div class="botdesc">
    <?php
    if ( is_category() ) {
    
    $cat_id = get_query_var('cat');
    $cat_data = get_option("category_$cat_id");
    if (isset($cat_data['bottomdescription'])){
    echo do_shortcode($cat_data['bottomdescription']);
    }
                        } 
    
    ?>
    </div>
    
                </div>
            </div>
    
            <?php
                $aLatest = array();
                foreach ($aLatestPosts as $oPost) {
                    $sLatest = '
                        <li>
                            <a href="' . get_permalink($oPost->ID) . '" title="' . $oPost->post_title . '">' . $oPost->post_title . '</a>
                            <span class="post-date">' . date('d.m.Y', strtotime($oPost->post_date)) . '</span>
                        </li>
                    ';
                    $aLatest []= $sLatest;
                }
                $sLatest = '
                    <div class="sideelement">
                        <h2>Letzte Beitr?ge</h2>
                        <ul>
                            ' . implode($aLatest) . '
                        </ul>
                    </div>
                ';
                $aCategoryHtmls = array();
                foreach ($aCategories as $iKey => $oCategory) {
                    $sCategoryHTML = '
                        <li class="cat-item cat-item-8">
                            <a href="' . get_category_link($oCategory->term_id) . '" title="' . $oCategory->description . '">' . $oCategory->name . '</a>
                        </li>
                    ';
                    $aCategoryHTMLs []= $sCategoryHTML;
                }
                $sCategories = '
                    <div class="sideelement">
                        <h2>Kategorien</h2>
                        <ul>
                            ' . implode($aCategoryHTMLs) . '
                        </ul>
                    </div>
                ';
                $sSidebar = '
                    <aside class="offerSidebar hidden-phone">
                        ' . $sLatest . '
                        ' . $sCategories . '
                    </aside>
                ';
                echo $sSidebar;
            ?>
    
        </div>
        <!-- /Narrow centered Heading -->
        <!-- content -->
    </div>
    <!-- /container -->
    
    <?php get_footer(); ?>
    
    <!--
    
    <?php get_header(); die; ?>
    
    		<?php if (have_posts()) : ?>
    
     			<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
    
    			<?php /* If this is a category archive */ if (is_category()) { ?>
    				<h2>Archive for the ‘<?php single_cat_title(); ?>’ Category</h2>
    
    			<?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
    				<h2>Posts Tagged ‘<?php single_tag_title(); ?>’</h2>
    
    			<?php /* If this is a daily archive */ } elseif (is_day()) { ?>
    				<h2>Archive for <?php the_time('F jS, Y'); ?></h2>
    
    			<?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
    				<h2>Archive for <?php the_time('F, Y'); ?></h2>
    
    			<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
    				<h2 class="pagetitle">Archive for <?php the_time('Y'); ?></h2>
    
    			<?php /* If this is an author archive */ } elseif (is_author()) { ?>
    				<h2 class="pagetitle">Author Archive</h2>
    
    			<?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
    				<h2 class="pagetitle">Blog Archives</h2>
    
    			<?php } ?>
    
    			<?php include (TEMPLATEPATH . '/inc/nav.php' ); ?>
    
    			<?php while (have_posts()) : the_post(); ?>
    
    				<div <?php post_class() ?>>
    
    						<h2 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
    
    						<?php include (TEMPLATEPATH . '/inc/meta.php' ); ?>
    
    						<div class="entry">
    							<?php the_content(); ?>
    						</div>
    
    				</div>
    
    			<?php endwhile; ?>
    
    			<?php include (TEMPLATEPATH . '/inc/nav.php' ); ?>
    
    	<?php else : ?>
    
    		<h2>Nothing found</h2>
    
    	<?php endif; ?>
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>
    -->

    And functions.php:

    <?php
    
    function enqueue_scripts_to_the_head() { // Our own unique function called enqueue_scripts_to_the_head
        //wp_enqueue_script('jquery');  // Enqueue jQuery that's already built into WordPress
    	wp_deregister_script( 'jquery' ); // deregisters the default WordPress jQuery
    	wp_register_script('jquery', 'https://code.jquery.com/jquery-latest.min.js'); // register the external file
        wp_register_script( 'nat-1', get_template_directory_uri() . '/js/jquery-ui-1.9.2.custom.min.js', '', null,''  );
        wp_register_script( 'nat-2', get_template_directory_uri() . '/js/bootstrap.min.js', '', null,''  );
    	wp_register_script( 'nat-3', get_template_directory_uri() . '/js/jquery.stylish-select.min.js', '', null,''  );
    	wp_register_script( 'nat-4', get_template_directory_uri() . '/js/custom-form-elements.js', '', null,''  );
    	wp_register_script( 'nat-5', get_template_directory_uri() . '/js/jquery.flexslider.js', '', null,''  );
    	wp_register_script( 'nat-6', get_template_directory_uri() . '/js/script.js', '', null,''  );
    	wp_register_script( 'nat-7', get_template_directory_uri() . '/js/modernizr.custom.82896.js', '', null,''  );
    	wp_register_script( 'nat-8', get_template_directory_uri() . '/js/fake_placeholder.js', '', null,''  );
    
    	wp_enqueue_script('jquery'); // enqueue the external file
        wp_enqueue_script( 'nat-1' );
        wp_enqueue_script( 'nat-2' );
        wp_enqueue_script( 'nat-3' );
        wp_enqueue_script( 'nat-4' );
        wp_enqueue_script( 'nat-5' );
        wp_enqueue_script( 'nat-6' );
        wp_enqueue_script( 'nat-7' );
        wp_enqueue_script( 'nat-8' );
    }
    add_action( 'wp_enqueue_scripts', 'enqueue_scripts_to_the_head' ); //Hooks our custom function into WP's wp_enqueue_scripts function
    
    ?>
    
    <?php
    
    global $bDontIncludeACF;
    if (!isset($bDontIncludeACF)) {
        #include_once( rtrim( dirname( __FILE__ ), '/' ) . '/plugins/acf-location-field/location-field.php' );
    }
    include_once dirname(__FILE__).'/inc/vt_resize.php';
    
    add_theme_support('post-thumbnails'); 
    
    function register_menus() {
        register_nav_menus(
            array(
                'footer-partner' => 'Footer Premium Partner',
                'header-small'   => 'Header Klein'
            )
        );
    }
    add_action('init', 'register_menus');
    
    // Dynamische Sidebar registrieren
    register_sidebar(array(
        'name' => 'Blog Sidebar',
        'before_widget' => '<div class="sideelement">',
        'after_widget' => '</div>',
        'before_title' => '<h2>',
        'after_title' => '</h2>',
        'class' => ''
    ));
    
    register_nav_menus(array(
        'footer-social'  => 'Social Media Footer Menü',
        'footer-partner' => 'Partner Footer Menü',
        'footer-travels' => 'Unsere Reisen'
    ));
    
    if (!function_exists( 'get_blog_url' ) ) {
        function get_blog_url(){
            if( $posts_page_id = get_option('page_for_posts') ){
                return home_url(get_page_uri($posts_page_id));
            } else {
                return home_url();
            }
        }
    }
    
    /// anfrageformular
    add_action('init', 'register_anfrage_rewrite');
    function register_anfrage_rewrite () {
        add_rewrite_tag('%anfrage_reference%','([^&]+)');
        foreach (array('individualreise-anfragen', 'anfrage') as $sSeite) {
            add_rewrite_rule($sSeite . '/([^/]+)(/[0-9]+)?/?$', 'index.php?pagename=' . $sSeite . '&page=' . $sSeite . '&anfrage_reference=$matches[1]', 'top');
        }
        flush_rewrite_rules(false);
    }
    
    // Felder
    add_action('acf/register_fields', 'my_register_fields');
    
    function my_register_fields() {
        //include_once('add-ons/acf-repeater/repeater.php');
        //include_once('add-ons/acf-gallery/gallery.php');
        //include_once('add-ons/acf-flexible-content/flexible-content.php');
    }
    
    // Optionen-Seite
    //include_once( 'add-ons/acf-options-page/acf-options-page.php' );
    
    /**
     *  Register Field Groups
     *
     *  The register_field_group function accepts 1 array which holds the relevant data to register a field group
     *  You may edit the array as you see fit. However, this may result in errors if the array is not compatible with ACF
     */
    if (function_exists("register_field_group")) {
        register_field_group(array (
            'id' => 'acf_blog-einleitungstext',
            'title' => 'Blog Einleitungstext',
            'fields' => array(
                array(
                    'key' => 'field_5181587ccfe81',
                    'label' => 'Einleitungstext',
                    'name' => 'teaser',
                    'type' => 'wysiwyg',
                    'instructions' => 'Wird auf der Blogübersichts-Seite angezeigt',
                    'default_value' => '',
                    'toolbar' => 'basic',
                    'media_upload' => 'no',
                ),
            ),
            'location' => array(
                'rules' => array(
                    array(
                        'param' => 'post_type',
                        'operator' => '==',
                        'value' => 'post',
                        'order_no' => 0,
                    ),
                ),
                'allorany' => 'all',
            ),
            'options' => array(
                'position' => 'normal',
                'layout' => 'no_box',
                'hide_on_screen' => array(
                ),
            ),
            'menu_order' => 1000,
        ));
    
        // Slider
        register_field_group(array (
            'id' => 'acf_slider',
            'title' => 'Slider',
            'fields' => array(
                array(
                    'key' => 'field_51d5a0e52f3a1',
                    'label' => 'Slider Elemente',
                    'name' => 'slider',
                    'type' => 'repeater',
                    'sub_fields' => array(
                        array(
                            'key' => 'field_51d5a1442f3a5',
                            'label' => 'Bild',
                            'name' => 'image',
                            'type' => 'image',
                            'column_width' => '',
                            'save_format' => 'id',
                            'preview_size' => 'medium',
                        ),
                        array(
                            'key' => 'field_51d5a1012f3a2',
                            'label' => 'überschrift',
                            'name' => 'headline',
                            'type' => 'text',
                            'column_width' => '',
                            'default_value' => '',
                            'formatting' => 'none',
                        ),
                        array(
                            'key' => 'field_51d5a1172f3a3',
                            'label' => 'Text',
                            'name' => 'text',
                            'type' => 'text',
                            'column_width' => '',
                            'default_value' => '',
                            'formatting' => 'none',
                        ),
                        array(
                            'key' => 'field_51d5a12b2f3a4',
                            'label' => 'Link',
                            'name' => 'link',
                            'type' => 'text',
                            'column_width' => '',
                            'post_type' => array(
                                0 => '',
                            ),
                            'allow_null' => 0,
                            'multiple' => 0,
                        ),
                    ),
                    'row_min' => 0,
                    'row_limit' => '',
                    'layout' => 'table',
                    'button_label' => 'Zeile hinzufügen',
                ),
            ),
            'location' => array(
                'rules' => array(
                    array(
                        'param' => 'page_template',
                        'operator' => '==',
                        'value' => 'startseite.php',
                        'order_no' => 0,
                    ),
                    array (
                        'param' => 'post_type',
                        'operator' => '==',
                        'value' => 'landingpage',
                        'order_no' => 1,
                    ),
                ),
                'allorany' => 'any',
            ),
            'options' => array(
                'position' => 'normal',
                'layout' => 'default',
                'hide_on_screen' => array(
                ),
            ),
            'menu_order' => 0,
        ));
    
        /// landingpage tabs
        register_field_group(array (
            'id' => 'acf_landingpage-tabs',
            'title' => 'Landingpage Tabs',
            'fields' => array (
                array (
                    'key' => 'field_5176b44858190',
                    'label' => 'Tabs',
                    'name' => 'tabs',
                    'type' => 'repeater',
                    'sub_fields' => array (
                        array (
                            'key' => 'field_5176b5b258193',
                            'label' => 'Tab überschrift',
                            'name' => 'tab_title',
                            'type' => 'text',
                            'column_width' => '',
                            'default_value' => '',
                            'formatting' => 'html',
                        ),
                        array (
                            'key' => 'field_5176b59b58192',
                            'label' => 'Tab Inhalt',
                            'name' => 'tab_content',
                            'type' => 'wysiwyg',
                            'column_width' => '',
                            'default_value' => '',
                            'toolbar' => 'full',
                            'media_upload' => 'yes',
                        ),
                        array (
                            'key' => 'field_51ff6af30c865',
                            'label' => 'Bilder Rechts',
                            'name' => 'tab_right_pics',
                            'type' => 'repeater',
                            'column_width' => '',
                            'sub_fields' => array (
                                array (
                                    'key' => 'field_51ff6b200c866',
                                    'label' => 'Bild',
                                    'name' => 'tab_right_pic',
                                    'type' => 'image',
                                    'column_width' => '',
                                    'save_format' => 'id',
                                    'preview_size' => 'thumbnail',
                                ),
                            ),
                            'row_min' => 0,
                            'row_limit' => '',
                            'layout' => 'row',
                            'button_label' => 'Zeile hinzufügen',
                        ),
                    ),
                    'row_min' => 0,
                    'row_limit' => '',
                    'layout' => 'table',
                    'button_label' => 'Zeile hinzufügen',
                ),
            ),
            'location' => array (
                'rules' => array (
                    array (
                        'param' => 'post_type',
                        'operator' => '==',
                        'value' => 'landingpage',
                        'order_no' => 0,
                    ),
                ),
                'allorany' => 'all',
            ),
            'options' => array (
                'position' => 'normal',
                'layout' => 'no_box',
                'hide_on_screen' => array (
                ),
            ),
            'menu_order' => 0,
        ));
    }
    
    /**
     * @return string
     */
    function nat_initerary_static_gmap_url(array $bricks, $width, $height, $path = false, $pathColor = '0xff0000ff') {
    
        foreach ($bricks as $brick) {
            if (isset($brick->lat) && isset($brick->long)) {
                $coords[] = array(
                    'lat'  => $brick->lat,
                    'long' => $brick->long
                );
            }
        }
    
        $markers = array();
    
        for ($i = 1, $len = count($coords); $i < $len; ++$i) {
            $markers[] = sprintf('markers=color:%s|label:%s|%s,%s',
                '0x9da31d',
                $i,
                $coords[$i]['lat'],
                $coords[$i]['long']
            );
        }
    
        $path = '';
    
        if (true) {
            $path = '&path=color:'.$pathColor.'|weight:4';
    
            foreach ($coords as $coord) {
                $path .= '|'.$coord['lat'].','.$coord['long'];
            }
        }
    
        $url = sprintf(
            'https://maps.googleapis.com/maps/api/staticmap?size=%sx%s&maptype=roadmap&%s&sensor=false&%s&key=AIzaSyDuh2t82AGuQmiYF3ghvyWqZe2vz5ZklYg',
            $width,
            $height,
            implode('&', $markers),
            $path
        );
    
        return $url;
    
    }
    
    function nat_get_text_marker(stdClass $travel, $markerName) {
        foreach($travel->_texts as $textMarker) {
            //var_dump($textMarker);die;
            if ($textMarker->_textmarker->name == $markerName) {
                return $textMarker->text;
            }
        }
    
        return false;
    }
    
    /**
     * @return array
     */
    function nat_get_articles_home() {
        return wp_get_recent_posts(array(
            'numberposts' => 6,
            'post_status' => 'publish',
            'orderby'     => 'post_date',
            'order'       => 'DESC',
        ));
    }
    
    function get_pagination($uriBase = '/blog', $useGet = false) {
        global $wp_query;
    
        $total_pages = $wp_query->max_num_pages;
        $current_page = max(1, get_query_var('paged'));
    
        if ($total_pages == 1) {
            return;
        }
    
        echo '
            <div class="pagination pagination-centered">
                <ul>
        ';
    
        if ($current_page != 1) {
            echo '
                <li class="prev">
                    <a href="'.$uriBase.'/page/'.($current_page - 1).'" rel="prev">
    
                    </a>
                </li>
            ';
        }
    
        for ($i = 1; $i <= $total_pages; ++$i) {
            echo sprintf(
                '<li class="%s"><a href="%s">'.$i.'</a></li>',
                ($i == $current_page ? 'active' : ''),
                $uriBase.'/page/'.$i
            );
    
            if ($total_pages > 15 && $i == 15) {
                echo '<li class="disabled"><a href="javascript:void(0);">...</a></li>';
                break;
            }
        }
    
        if ($current_page != $total_pages) {
            echo '
                <li class="disabled next"><a href="'.$uriBase.'/page/'.($current_page + 1).'" rel="next"><i class="pagRight"></i></a></li>
            ';
        }
    
        echo '  </ul>
            </div>
        ';
    }
    
    function nat_get_landingpage_articles($folderId) {
        global $wpdb;
    
        $folder = $wpdb->get_results(
            "SELECT id,text FROM vg_websitefolders WHERE id = '".(int) $folderId."' ORDER BY text ASC",
            OBJECT
        );
    
        if ($folder) {
            $blogCategoryName = sprintf(
                '%s News',
                ucfirst($folder[0]->text)
            );
    
            $categoryId = get_cat_ID($blogCategoryName);
    
            if ($categoryId) {
                $args = array(
                    'orderby'     => 'post_date',
                    'order'       => 'DESC',
                    'post_status' => 'publish',
                    'post_type'   => 'post',
                    'cat'         => $categoryId
                );
                $q = new WP_Query();
    
                return array(
                    'name' => $blogCategoryName,
                    'articles' => $q->query($args),
                    'categoryId' => $categoryId
                );
            }
    
        }
    
        return array();
    
    }
    
    function nat_calculate_pagination ($aItems, $iItemsPerPage = 5) {
    
        if (isset($_REQUEST['pagenr'])) {
            $iCurrentPageNr = intval($_REQUEST['pagenr']);
        } else {
            $iCurrentPageNr = 1;
        }
        $iItems = count($aItems);
        $iStartTravel = ($iCurrentPageNr - 1) * $iItemsPerPage;
        $iEndTravel = $iStartTravel + $iItemsPerPage - 1;
        if ($iEndTravel >= $iItems) {
            $iEndTravel = $iItems - 1;
        }
        $aItemsTemp = array();
        for ($iT = $iStartTravel; $iT <= $iEndTravel; $iT ++) {
            $aItemsTemp []= $aItems[$iT];
        }
        $aItems = $aItemsTemp;
        $iTotalPages = ceil($iItems / $iItemsPerPage);
        $aPaginatorData = nat_get_paginator_data($iTotalPages, $iCurrentPageNr);
    
        return array($aItems, $aPaginatorData);
    
    }
    
    function nat_get_paginator_data ($iPages, $iActivePageNr, $bGaps = true) {
    
        $aPrev = null;
        $aNext = null;
        $aPages = array();
    
        $sUri = isset($_SERVER['REDIRECT_URL']) ? $_SERVER['REDIRECT_URL'] : $_SERVER['REQUEST_URI'];
        $aGetParams = $_GET;
        for ($iP = 0; $iP < $iPages; $iP ++) {
            $iPageNr = $iP + 1;
            $aGetParams['pagenr'] = $iPageNr;
            $sHref = make_href($aGetParams);
            $aPage = array('iNr' => $iPageNr, 'sHref' => $sHref, 'bActive' => $iPageNr == $iActivePageNr);
            if ($iPageNr == $iActivePageNr - 1) {
                $aPrev = $aPage;
            }
            if ($iPageNr == $iActivePageNr + 1) {
                $aNext = $aPage;
            }
            $aPages []= $aPage;
        }
    
        if ($bGaps) {
            $iMaxInActivePart = 5;
            $iMaxInInactivePart = 1;
            $iPages = count($aPages);
            if ($iPages > $iMaxInActivePart + 4) {
                $aParts = array();
                if ($iActivePageNr < $iMaxInActivePart) {
                    $aParts []= array(1, $iMaxInActivePart);
                    $aParts []= array($iPages, $iPages);
                } else if (($iPages - $iActivePageNr) + 1 < $iMaxInActivePart) {
                    $aParts []= array(1, 1);
                    $aParts []= array($iPages - $iMaxInActivePart + 1, $iPages);
                } else {
                    $aParts []= array(1, 1);
                    $aParts []= array($iActivePageNr - 2, $iActivePageNr + 2);
                    $aParts []= array($iPages, $iPages);
                }
                $aAllPages = $aPages;
                $aPages = array();
                $bFirstPart = true;
                foreach ($aParts as $aPart) {
                    if ($bFirstPart) {
                        $bFirstPart = false;
                    } else {
                        $aPages []= array(
                             'iNr' => null
                            ,'sHref' => null
                            ,'bActive' => false
                        );
                    }
                    for ($iP = $aPart[0]; $iP <= $aPart[1]; $iP ++) {
                        $aPages []= $aAllPages[$iP - 1];
                    }
                }
            }
        }
    
        return array(
             'aPages' => $aPages
            ,'aPrev'  => $aPrev
            ,'aNext'  => $aNext
        );
    
    }
    
    function nat_make_paginator_page_html ($aPaginatorData) {
    
        if (count($aPaginatorData['aPages']) < 2) {
            return '';
        }
    
        $aPrev = $aPaginatorData['aPrev'];
        $aNext = $aPaginatorData['aNext'];
        $aPages = $aPaginatorData['aPages'];
    
        $aBlocks = array();
        if ($aPrev) {
            $aPage = $aPrev;
            $aClasses = array('tp_block', 'tp_prev', $aPage['bActive'] ? 'tp_active' : 'tp_inactive');
            $aBlocks []= array(
                 'sText' => ''
                ,'sHref' => $aPage['sHref']
                ,'aClasses' => $aClasses
            );
        }
        foreach ($aPages as $aPage) {
            $aClasses = array('tp_block', 'tp_page', $aPage['bActive'] ? 'tp_active' : 'tp_inactive');
            if (!$aPage['iNr']) {
                $aClasses []= 'tp_gap';
            }
            $aBlocks []= array(
                 'sText' => $aPage['iNr'] ? $aPage['iNr'] : '...'
                ,'sHref' => $aPage['sHref']
                ,'aClasses' => $aClasses
            );
        }
        if ($aNext) {
            $aPage = $aNext;
            $aClasses = array('tp_block', 'tp_next', $aPage['bActive'] ? 'tp_active' : 'tp_inactive');
            $aBlocks []= array(
                 'sText' => ''
                ,'sHref' => $aPage['sHref']
                ,'aClasses' => $aClasses
            );
        }
    
        $sPaginatorHtml = '';
        foreach ($aBlocks as $aBlock) {
            if ($aBlock['sHref']) {
                $sPaginatorHtml .= '<a class="' . implode(' ', $aBlock['aClasses']) . '" href="' . $aBlock['sHref'] . '">' . $aBlock['sText'] . '</a>';
            } else {
                $sPaginatorHtml .= '<span class="' . implode(' ', $aBlock['aClasses']) . '">' . $aBlock['sText'] . '</span>';
            }
        }
    
        $sPaginatorHtml = '<section class="travels_paginator"><div class="tp_blocks">' . $sPaginatorHtml . '</div></section>';
    
        return $sPaginatorHtml;
    
    }
    
    function make_href ($aGetParams, $sUri = null) {
    
        $aSingleGetParams = array();
        foreach ($aGetParams as $sKey => $mValue) {
            $aSingleGetParams []= array(
                 'aPath'  => array($sKey)
                ,'mValue' => $mValue
            );
        }
    
        for ($iS = 0; $iS < count($aSingleGetParams); $iS ++) {
            $aParam = $aSingleGetParams[$iS];
            if (is_array($aParam['mValue'])) {
                array_splice($aSingleGetParams, $iS, 1);
                foreach ($aParam['mValue'] as $sSubKey => $mSubValue) {
                    $aPath = $aParam['aPath'];
                    $aPath []= $sSubKey;
                    $aSingleGetParams []= array(
                         'aPath'  => $aPath
                        ,'mValue' => $mSubValue
                    );
                }
                $iS --;
            }
        }
    
        $aGetStrings = array();
        foreach ($aSingleGetParams as $aSingleGetParam) {
            $sKeyString = $aSingleGetParam['aPath'][0];
            for ($iP = 1, $iStop = count($aSingleGetParam['aPath']); $iP < $iStop; $iP ++) {
                $sKeyString .= '[' . $aSingleGetParam['aPath'][$iP] . ']';
            }
            $aGetStrings []= urlencode($sKeyString) . '=' . urlencode($aSingleGetParam['mValue']);
        }
    
        if (count($aGetStrings)) {
            $sGetParams = '?' . implode('&', $aGetStrings);
        } else {
            $sGetParams = '';
        }
    
        if ($sUri == null) {
            $aUri = explode('?', $_SERVER['REQUEST_URI']);
            $sUri = $aUri[0];
        }
    
        return 'https://' . $_SERVER['HTTP_HOST'] . $sUri . $sGetParams;
    
    }
    
    add_shortcode('akkordeon', 'nr_shortcode_akkordeon');
    function nr_shortcode_akkordeon ($aArguments, $sInnerContent, $sShortcode) {
    
        $aArguments = nr_digest_shortcode_arguments($aArguments);
    
        global $aAkkordeonBereiche;
        $aAkkordeonBereiche = array();
        $sInnerContent = nr_process_standard_content($sInnerContent);
    
        $sAkkordeonHtml = '';
        foreach ($aAkkordeonBereiche as $aBereich) {
            $sBereichHtml = '
                <div class="na_bereich">
                    <h3 class="nas_head">' . $aBereich['aArguments']['ueberschrift'] . '</h3>
                    <div class="nas_body standard_content">' . $aBereich['sInnerContent'] . '</div>
                </div>
            ';
            $sAkkordeonHtml .= $sBereichHtml;
        }
    
        global $iAkkordeonNr;
        $iAkkordeonNr = intval($iAkkordeonNr) + 1;
        $sID = 'nat_akkordeon_' . $iAkkordeonNr;
    
        $sScript = '
            <script type="text/javascript">
                //<[CDATA[
    
                    (function () {
    
                        var oData = {};
                        oData.sNr = "' . $iAkkordeonNr . '";
                        oData.sID = "' . $sID . '";
                        oData.jAkkordeon = jQuery("#" + oData.sID);
                        oData.jAkkordeon.data("oAkkordeonData", oData);
    
                        oData.aSections = [];
                        var jSections = oData.jAkkordeon.find(".na_bereich");
                        for (var iS = 0; iS < jSections.length; iS ++) {
                            var oSection = {};
                            oSection.jSection = jSections.eq(iS);
                            oSection.jHead = oSection.jSection.find(".nas_head");
                            oSection.jBody = oSection.jSection.find(".nas_body");
                            oSection.bOpen = true;
                            oSection.open = function () {
                                this.jBody.show();
                                this.bOpen = true;
                            }
                            oSection.close = function () {
                                this.jBody.hide();
                                this.bOpen = false;
                            }
                            oSection.jHead.data("oSectionData", oSection);
                            oSection.jHead.click(function(){
                                var oSection = $(this).data("oSectionData");
                                if (oSection.bOpen) {
                                    oSection.close();
                                } else {
                                    oSection.open();
                                }
                            });
                            oSection.close();
                            oData.aSections.push(oSection);
                        }
    
                    })();
    
                //]]>
            </script>
        ';
    
        $sAkkordeonHtml = '<section id="' . $sID . '" class="nat_akkordeon">' . $sAkkordeonHtml . '</section>' . $sScript;
    
        return $sAkkordeonHtml;
    
    }
    
    add_shortcode('bereich', 'nr_shortcode_bereich');
    function nr_shortcode_bereich ($aArguments, $sInnerContent, $sShortcode) {
    
        $aArguments = nr_digest_shortcode_arguments($aArguments);
    
        $aFallbackArguments = array(
            'ueberschrift' => '---'
        );
        foreach ($aFallbackArguments as $sKey => $mFallbackValue) {
            if (!isset($aArguments[$sKey])) {
                $aArguments[$sKey] = $mFallbackValue;
            }
        }
    
        $sInnerContent = preg_replace('/\<p\>$/', '', $sInnerContent);
        $sInnerContent = preg_replace('/^\<\/p\>/', '', $sInnerContent);
    
        global $aAkkordeonBereiche;
        $aAkkordeonBereiche []= array(
             'aArguments'    => $aArguments
            ,'sInnerContent' => $sInnerContent
        );
    
    }
    
    function nr_digest_shortcode_arguments ($aAttr) {
    
        if (!is_array($aAttr)) {
            return $aAttr;
        }
    
        for ($i = 0; $i < 999; $i ++) {
    
            if (!array_key_exists($i, $aAttr)) {
                break;
            }
    
            $sText = $aAttr[$i];
            unset($aAttr[$i]);
    
            $aText = explode('=', $sText);
            $sKey = $aText[0];
            if (isset($aText[1])) {
                $sValue = $aText[1];
                $sValue = preg_replace('/^"/', '', preg_replace('/"$/', '', $sValue));
            } else {
                $sValue = null;
            }
    
            $aAttr[$sKey] = $sValue;
    
        }
    
        return $aAttr;
    
    }
    
    function nr_get_news_category_ids () {
        $aIDs = array();
        $aCategories = nr_get_news_categories();
        foreach ($aCategories as $oCategory) {
            $aIDs []= $oCategory->term_id;
        }
        return $aIDs;
    }
    
    function nr_get_report_category_ids () {
        $aIDs = array();
        $aCategories = nr_get_report_categories();
        foreach ($aCategories as $oCategory) {
            $aIDs []= $oCategory->term_id;
        }
        return $aIDs;
    }
    
    function nr_get_news_categories () {
        $aReturn = array();
        $aAllCategories = get_categories(array('hide_empty' => 0));
        foreach ($aAllCategories as $oCategory) {
            if (!preg_match('/^reiseberichte /i', $oCategory->name)) {
            #if (preg_match('/ news$/i', $oCategory->name)) {
                $aReturn []= $oCategory;
            }
        }
        return $aReturn;
    }
    
    function nr_get_report_categories () {
        $aReturn = array();
        $aAllCategories = get_categories(array('hide_empty' => 0));
        foreach ($aAllCategories as $oCategory) {
            if (preg_match('/^reiseberichte /i', $oCategory->name)) {
                $aReturn []= $oCategory;
            }
        }
        return $aReturn;
    }
    
    function nr_make_content_tabs_html ($aTabs) {
    
        $iTabs = count($aTabs);
        if ($iTabs == 0) {
            return '';
        }
        $bActiveSet = false;
        $aTabsTemp = array();
        for ($iT = 0; $iT < $iTabs; $iT ++) {
    
            $aTab = $aTabs[$iT];
    
            if (!isset($aTab['sID'])) {
                $aTab['sID'] = (1 + $iT) . '_' . nr_string_to_id($aTab['sTitle']);
            }
            $aTab['sID'] = preg_replace('/^\#/', '', $aTab['sID']);
    
            if ($aTab['bActive'] === true && isset($aTab['bActive']) && !$bActiveSet) {
                $bActiveSet = true;
            } else {
                $aTab['bActive'] = false;
            }
            if ($iT == 0) {
                $aTab['bFirst'] = true;
            } else {
                $aTab['bFirst'] = false;
            }
            if (1 + $iT == $iTabs) {
                $aTab['bLast'] = true;
            } else {
                $aTab['bLast'] = false;
            }
    
            $aTabsTemp []= $aTab;
    
        }
        if (!$bActiveSet) {
            $aTabsTemp[0]['bActive'] = true;
        }
        $aTabs = $aTabsTemp;
    
        $aTabHtmls = array();
        $aContentHtmls = array();
        foreach ($aTabs as $iKey => $aTab) {
            $aClasses = array();
            if ($aTab['bFirst']) $aClasses []= 'first';
            if ($aTab['bLast']) $aClasses []= 'last';
            if ($aTab['bActive']) $aClasses []= 'active';
            $aTabHtmls []= '
                <li class="' . implode(' ', $aClasses) . '">
                    <a class="fuehrer_tab_clicker" data-tab-id="' . $aTab['sID'] . '" href="javascript:void()">' . $aTab['sTitle'] . '<span/></a>
                </li>
            ';
            $sHide = $aTab['bFirst'] ? '' : 'style="display:none"';
            $aContentHtmls []= '
                <div class="fuehrer_tab_content content_for_' . $aTab['sID'] . '" ' . $sHide . ' >
                    <div class="contentblock contentblock_fuehrer standard_content">' . $aTab['sHtmlContent'] . '</div>
                </div>
            ';
        }
    
        return '
            <div class="content-tabs">
                <ul class="nav nav-tabs">
                    ' . implode("\n", $aTabHtmls) . '
                </ul>
            </div>
            <div id="main-content">
                <div class="tab-content standard_content">
                    ' . implode("\n", $aContentHtmls) . '
                </div>
            </div>
        ';
    
    }
    
    function nr_string_to_id ($sString) {
    
        $aReplaceMap = array (
            'à' => 'A', 'á' => 'A', '?' => 'A', '?' => 'A', '?' => 'Ae', '?' => 'A', '?' => 'AE', '?' =>
            'C', 'è' => 'E', 'é' => 'E', 'ê' => 'E', '?' => 'E', 'ì' => 'I', 'í' => 'I', '?' => 'I',
            '?' => 'I', 'D' => 'D', '?' => 'N', 'ò' => 'O', 'ó' => 'O', '?' => 'O', '?' => 'O', '?' =>
            'Oe', '?' => 'O', '?' => 'O', 'ù' => 'U', 'ú' => 'U', '?' => 'U', 'ü' => 'Ue', '?' => 'U',
            'Y' => 'Y', 'T' => 'TH', '?' => 'ss', 'à' => 'a', 'á' => 'a', 'a' => 'a', '?' => 'a', '?' =>
            'ae', '?' => 'a', '?' => 'ae', '?' => 'c', 'è' => 'e', 'é' => 'e', 'ê' => 'e', '?' => 'e',
            'ì' => 'i', 'í' => 'i', '?' => 'i', '?' => 'i', 'e' => 'd', '?' => 'n', 'ò' => 'o', 'ó' =>
            'o', '?' => 'o', '?' => 'o', '?' => 'oe', '?' => 'o', '?' => 'o', 'ù' => 'u', 'ú' => 'u',
            '?' => 'u', 'ü' => 'ue', '?' => 'u', 'y' => 'y', 't' => 'th', '?' => 'y', ' ' => '_'
        );
        foreach ($aReplaceMap as $sA => $sB) {
            $sString = str_replace($sA, $sB, $sString);
        }
        $sString = strtolower($sString);
        $sString = preg_replace('/[^0-9a-z_]/', '', $sString);
    
        return $sString;
    
    }
    
    function nr_get_meta_multifield ($aMeta, $sMultiKey, $aSubKeys = null) {
    
        if ($aSubKeys) {
            if (is_string($aSubKeys)) {
                $aSubKeys = array($aSubKeys);
                $aFuncArgs = func_get_args();
                if (count($aFuncArgs) > 3) {
                    for ($iA = 3; $iA < count($aFuncArgs); $iA ++) {
                        $aSubKeys []= $aFuncArgs[$iA];
                    }
                }
            }
        } else {
            $aSubKeys = array();
            foreach ($aMeta as $sMetaKey => $sMetaValues) {
                if (preg_match('/^' . $sMultiKey . '_\d*_(.*)$/', $sMetaKey, $aMatches)) {
                    $sSubKey = $aMatches[1];
                    if (!in_array($sSubKey, $aSubKeys)) {
                        $aSubKeys []= $sSubKey;
                    }
                }
            }
        }
    
        $aItems = array();
        $iItems = intval($aMeta[$sMultiKey][0]);
        for ($iI = 0; $iI < $iItems; $iI ++) {
            $aNewItem = array();
            foreach ($aSubKeys as $sSubKey) {
                $sMetaKey = $sMultiKey . '_' . $iI . '_' . $sSubKey;
                $aNewItem[$sSubKey] = null;
                if (isset($aMeta[$sMetaKey]) && isset($aMeta[$sMetaKey][0])) {
                    $aNewItem[$sSubKey] = $aMeta[$sMetaKey][0];
                }
            }
            if (count($aSubKeys) == 1) {
                $aNewItem = $aNewItem[$aSubKeys[0]];
            }
            $aItems []= $aNewItem;
        }
    
        return $aItems;
    
    }
    
    function nr_make_breadcrumb_html ($aParts) {
    
        $aPartHtmls = array();
        for ($iP = 0; $iP < count($aParts); $iP ++) {
            $aPart = $aParts[$iP];
            if ($iP == count($aParts) - 1) {
                $sHtml = '<li class="active">' . $aPart['sText'] . '</li>';
            } else {
                $sText = $aPart['sText'];
                if (isset($aPart['sHref'])) {
                    $sTitle = isset($aPart['sTitle']) ? $aPart['sTitle'] : $aPart['sText'];
                    $sText = '<a title="' . $sTitle . '" href="' . $aPart['sHref'] . '">' . $sText . '</a>';
                }
                $sHtml = '<li>' . $sText . ' <span class="divider">></span></li>';
            }
            $aPartHtmls []= $sHtml;
        }
    
        $sHtml = '
            <div class="contentblock">
                <ul class="offset1 breadcrumb">
                    ' . implode("\n", $aPartHtmls) . '
                </ul>
            </div>
        ';
    
        return $sHtml;
    
    }
    
    function nr_get_breadcrumb_path_to_webfolder ($iFolderID, $sLinkTo = null) {
    
        global $wpdb;
    
        $iFolderID = intval($iFolderID);
    
        $aFolderParentResult = $wpdb->get_results("SELECT * FROM vg_websitefolders WHERE id=" . $iFolderID . ";");
        $iFolderParentID = intval($aFolderParentResult[0]->parentId);
    
        if (nr_get_folder_type($iFolderID) == 'continent') {
            $aCrumbIDs = array($iFolderID);
        } else {
            $aCrumbIDs = array($iFolderParentID, $iFolderID);
        }
    
        $aCrumbsData = $wpdb->get_results("SELECT * FROM vg_websitefolders WHERE id IN(" . implode(",", $aCrumbIDs) . ");");
        $aCrumbs = array();
        foreach ($aCrumbsData as $oCrumbData) {
            $aCrumb['sText'] = $oCrumbData->text;
            if ($sLinkTo == 'reiseführer') {
                $oCrumbPost = nr_get_webfolder_reisefuehrer($oCrumbData->id);
                if ($oCrumbPost) {
                    $aCrumb['sHref'] = get_permalink($oCrumbPost->ID);
                    $aCrumb['sTitle'] = nr_post_get_seo_title($oCrumbPost, true);
                }
            } else if ($sLinkTo == 'landingpage') {
                $aPosts = get_posts(array(
                    'numberposts' => -1,
                    'post_type' => 'landingpage',
                    'meta_query'  => array(
                        array(
                            'key'     => 'website_folders_id',
                            'compare' => '=',
                            'value'   => $oCrumbData->id
                        )
                    )
                ));
                if (count($aPosts)) {
                    $aCrumb['sHref'] = get_permalink($aPosts[0]->ID);
                    $aCrumb['sTitle'] = nr_post_get_seo_title($aPosts[0], true);
                }
            }
            $aCrumbs []= $aCrumb;
        }
    
        return $aCrumbs;
    
    }
    
    function nr_random_subset ($aItems, $iRandom) {
    
        $iRandom = min(count($aItems), $iRandom);
        $aRandomKeys = array();
        $iSafety = 99;
        while (count($aRandomKeys) < $iRandom) {
            if ($iSafety < 1) break;
            $iSafety --;
            $iRandKey = array_rand($aItems);
            if (!in_array($iRandKey, $aRandomKeys)) {
                $aRandomKeys []= $iRandKey;
            }
        }
        $aRandom = array();
        foreach ($aRandomKeys as $iRK) {
            $aRandom []= $aItems[$iRK];
        }
        return $aRandom;
    
    }
    
    function nr_post_get_seo_title ($oPost, $bFallback = true) {
        $aSeoData = nr_post_get_seo_data($oPost, $bFallback);
        return $aSeoData['sTitle'];
    }
    
    function nr_post_get_seo_data ($oPost, $bFallback = true) {
    
        if (!is_object($oPost)) {
            $oPost = get_post($oPost);
        }
    
        $aSeoData = array(
             'sKeywords' => ''
            ,'sTitle' => ''
            ,'sDescription' => ''
        );
        if ($bFallback) {
            $aSeoData['sTitle'] = $oPost->post_title;
        }
    
        $aMeta = get_post_custom($oPost->ID);
        if (isset($aMeta['_yoast_wpseo_focuskw']) && $aMeta['_yoast_wpseo_focuskw'][0]) {
            $aSeoData['sKeywords'] = $aMeta['_yoast_wpseo_focuskw'][0];
        }
        if (isset($aMeta['_yoast_wpseo_title']) && $aMeta['_yoast_wpseo_title'][0]) {
            $aSeoData['sTitle'] = $aMeta['_yoast_wpseo_title'][0];
        }
        if (isset($aMeta['_yoast_wpseo_metadesc']) && $aMeta['_yoast_wpseo_metadesc'][0]) {
            $aSeoData['sDescription'] = $aMeta['_yoast_wpseo_metadesc'][0];
        }
    
        return $aSeoData;
    
    }
    
    function nr_travel_get_seo_title ($oTravel) {
        $aSeoData = nr_travel_get_seo_data($oTravel);
        return $aSeoData['sTitle'];
    }
    
    function nr_travel_get_seo_data ($oTravel) {
    
        if (!is_object($oTravel)) {
            $oTravel = vg_get_travel_details($oTravel);
        }
        $aSeoData = array(
             'sTitle' => $oTravel->_seo->title
            ,'sDescription' => $oTravel->_seo->description
            ,'sKeywords' => $oTravel->_seo->keywords
        );
        return $aSeoData;
    
    }
    
    function nr_category_get_seo_title ($oCategory, $bFallback = true) {
        $aSeoData = nr_category_get_seo_data($oCategory, $bFallback);
        return $aSeoData['sTitle'];
    }
    
    function nr_category_get_seo_data ($oCategory, $bFallback = true) {
    
        if (!is_object($oCategory)) {
            $oCategory = get_the_category($oCategory);
        }
    
        $aSeoData = array();
    
        $iTermID = $oCategory->term_id;
        $aSeoMeta = get_option('wpseo_taxonomy_meta');
        if (isset($aSeoMeta[$oCategory->taxonomy][$iTermID])) {
            $aCategoryMeta = $aSeoMeta[$oCategory->taxonomy][$iTermID];
            $aSeoData['sTitle'] = $aCategoryMeta['wpseo_title'];
            $aSeoData['sDescription'] = $aCategoryMeta['wpseo_desc'];
        } else if ($bFallback) {
            $aSeoData['sTitle'] = $oCategory->name;
            $aSeoData['sDescription'] = $oCategory->category_description;
        }
    
        return $aSeoData;
    
    }
    
    function nr_echo_travel_standard_list_item ($oTravel, $iNr) {
        ?>
            <?php $sLinkAttrs = 'title="' . $oTravel->_seo->title . '" href="/' . $oTravel->_seo->url . '"'; ?>
            <!-- offersBox -->
            <section class="offersBox">
                <div class="contentblock">
                    <div class="span4 content-image">
                        <figure>
                            <?php if ($oTravel->_website_images[0]->public_url) { ?>
                                <a class="travel_link_wrap" <?php echo $sLinkAttrs; ?> ><img src="<?php echo $oTravel->_website_images[0]->public_url; ?>?width=279&bestfit=true&noupscale=true" alt=""/></a>
                            <?php } ?>
                        </figure>
                        <a class="weitere_infos hide_on_mobile" href="#" data-targetblock="#block-<?php echo $iNr; ?>"> + weitere Infos einblenden</a>
                    </div>
                    <div class="span7 offers-text">
                        <div class="contentblock">
                            <div class="text-left">
                                <h3><a class="travel_link_wrap" <?php echo $sLinkAttrs; ?>><?php echo htmlspecialchars($oTravel->title); ?></a></h3>
                            </div>
                            <div class="text-right">
                                <!--<a href="#">Merken</a>-->
                                <a class="greenLink hide_on_mobile" <a <?php echo $sLinkAttrs; ?> >Zur Reise<span>arrow</span></a>
                            </div>
                        </div>
                        <div class="contentblock">
                            <p><?php echo $oTravel->short_description; ?></p>
                        </div>
                        <div class="contentblock">
                            <div class="text-left">
                                <p>
                                    <?php echo ($oTravel->type == 'group' ? 'Gruppenreise' : 'Individualreise'); ?>
                                </p>
                            </div>
                            <div class="text-right">
                                <span><?php echo $oTravel->days; ?> Tage ab </span>
                                <strong> <?php echo number_format($oTravel->price, 2, ',', '.'); ?>&nbsp;&euro;</strong>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="contentblock offers-dropdown" id="block-<?php echo $iNr; ?>">
                    <?php if (count($oTravel->_bricks) && $oTravel->_bricks[0]->lat) { ?>
                        <div id="itinerary-map-<?php echo $iNr; ?>" class="span4 content-image">
                            <a href="">
                                <img src="<?php echo esc_attr(nat_initerary_static_gmap_url($oTravel->_bricks, 279, 279, true, '0x6b8f82c8')); ?>" alt="Reiseverlauf">
                            </a>
                        </div>
                    <?php } ?>
                    <div class="span7 offers-text">
                        <div class="contentblock">
                            <ul>
                                <?php for ($i = 0, $highlights = explode("\n", $oTravel->included_services); $i < 5 && $i < count($highlights); ++$i) { ?>
                                    <li><?php echo $highlights[$i]; ?></li>
                                <?php } ?>
                            </ul>
                        </div>
                    </div>
                </div>
            </section>
            <!-- /offersBox -->
        <?php
    }
    
    function nr_get_folder_news ($iFolderID) {
        return nat_get_landingpage_articles($iFolderID);
    }
    
    function nr_make_fuehrer_news_html ($iFolderID, $iMaxNews = 10) {
    
        $oFolder = get_webfolder($iFolderID);
        $aASDF = nr_get_folder_news($iFolderID);
        $iCategoryID = $aASDF['categoryId'];
        $sCategoryName = $aASDF['name'];
        $aPosts = $aASDF['articles'];
        if (!count($aPosts)) {
            return '';
        }
    
        $aPostHtmls = array();
        foreach ($aPosts as $oPost) {
            if (count($aPostHtmls) >= $iMaxNews) {
                break;
            }
            $iPostID = $oPost->ID;
            setup_postdata($oPost);
            if (has_post_thumbnail($iPostID)) {
                $iImageID = get_post_thumbnail_id($iPostID);
                $sThumbnail = nr_make_image_html($iImageID, 300, null);
            } else {
                $sThumbnail = '';
            }
            if (get_field('teaser', $iPostID)) {
                $sText = get_field('teaser', $iPostID);
            } else {
                $sText = get_the_excerpt();
            }
            $sPermalink = get_permalink($iPostID);
            $sSeoTitle = nr_post_get_seo_title($oPost, true);
            $aPostHtmls []= '
                <div class="post news_post">
                    ' . $sThumbnail . '
                    <h3>
                        <a title="' . $sSeoTitle . '" href="' . $sPermalink . '" target="_blank">' . htmlspecialchars($oPost->post_title) . '</a>
                    </h3>
                    <p>
                    ' . $sText . '
                    </p>
                    <a title="' . $sSeoTitle . '" href="' . $sPermalink . '" target="_blank" class="more">&rsaquo; Weiterlesen</a>
                </div>
            ';
        }
        $sHtml = '
            <div class="news_posts">
                <h2>' . $sCategoryName . '</h2>
                ' . implode($aPostHtmls) . '
                <div class="news_posts_category_link_wrapper">
                    <a target="_blank" href="' . get_category_link($iCategoryID) . '">&rsaquo; Hier finden Sie alle ' . $oFolder->text . '-Reise-News</a>
                </div>
            </div>
        ';
    
        return $sHtml;
    
    }
    
    function nr_make_image_html ($iImageID, $iWidth = null, $iHeight = null, $bCrop = false, $aAttrs = array(), $aData = array()) {
    
        $sSrc = nr_get_image_src($iImageID, $iWidth, $iHeight, $bCrop, $aData);
        if (!isset($aAttrs['src'])) {
            $aAttrs['src'] = nr_get_image_src($iImageID, $iWidth, $iHeight, $bCrop, $aData);
        }
        if (!isset($aAttrs['alt'])) {
            $aAttrs['alt'] = nr_get_image_alt($iImageID);
        }
        $aAttrs['width'] = $aData['iWidth'];
        $aAttrs['height'] = $aData['iHeight'];
        $sAttrs = '';
        foreach ($aAttrs as $sKey => $sValue) {
            $sAttrs .= ' ' . $sKey . '="' . htmlspecialchars($sValue) . '"';
        }
        return '<img' . $sAttrs . '>';
    
    }
    
    function nr_get_image_src ($iImageID, $iWidth = null, $iHeight = null, $bCrop = false, &$aData = array()) {
    
        $aImageData = wp_get_attachment_image_src($iImageID, 'full');
        $iOriginalWidth = $aImageData[1];
        $iOriginalHeight = $aImageData[2];
    
        if ($iWidth == null && $iHeight == null) {
            $sSrc = get_attached_file($iImageID);
        } else {
            if ($iWidth == null) {
                $iWidth = $iHeight * ($iOriginalWidth / $iOriginalHeight);
            }
            if ($iHeight == null) {
                $iHeight = $iWidth * ($iOriginalHeight / $iOriginalWidth);
            }
            $aResizeData = vt_resize($iImageID, '', $iWidth, $iHeight, $bCrop);
            $iWidth = $aResizeData['width'];
            $iHeight = $aResizeData['height'];
            $sSrc = $aResizeData['url'];
        }
    
        $aData['iWidth'] = $iWidth;
        $aData['iHeight'] = $iHeight;
    
        return $sSrc;
    
    }
    
    function nr_get_image_alt ($iImageID) {
    
        $aAttachmentMeta = get_post_meta($iImageID);
        if (isset($aAttachmentMeta['_wp_attachment_image_alt'])) {
            $sAlt = $aAttachmentMeta['_wp_a
  • The topic ‘Tags not showing on archive.php’ is closed to new replies.