Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // get custom field informations ############################################################################################
- include 'wp-content/themes/love/extras/custom_fields.php';
- // Redirects of pages #######################################################################################################
- // redirect to other website
- if($redirection_selection == 'website' && $redirect != false) :
- wp_redirect(clean_url($redirect), 301); // 301 means permanently
- exit;
- endif;
- // redirect to page
- if($redirection_selection == 'page' && $redirect != false) :
- wp_redirect($redirect, 301);
- exit;
- endif;
- // redirection to first child page
- if($redirection_selection == 'child' && $redirect == true) {
- if (have_posts()) {
- while (have_posts()) {
- the_post();
- $pagekids = get_pages("child_of=".$postID."&sort_column=menu_order");
- if ($pagekids) {
- $firstchild = $pagekids[0];
- $parent = ($post->post_parent) ? $post->post_parent : $postID;
- // redirect first child --> also possible: wp_redirect(get_permalink($parent->ID));
- wp_redirect(get_permalink($firstchild->ID), 301);
- exit;
- }
- }
- }
- }
- // Wordpress Header #########################################################################################################
- get_header();
- // only if activated in the settings of the 'homepage' (CFT)
- if($show_edit_button == true) edit_post_link('','<div class="edit-post-link">','</div>');
- ?>
- <div class="ym-column">
- <div class="ym-col1">
- <?php
- // Slideshow - position above the content ###############################################################################
- // works with the plugin ACF and in this case (the_repeater_field + the_sub_field)
- if($slideshow && $slideshow_type == 'big') :
- if($slideshow_ID == NULL) :
- echo '<strong style="color: red;">No slideshow ID set.</strong>';
- else :
- include 'wp-content/themes/love/extras/slideshow-snippet.php';
- endif;
- endif;
- // image for the top of the page (based on CTF)
- if($content_image) :
- $postid = $sidebar_image;
- $attachment = get_post($postid);
- $url = wp_get_attachment_url($postid);
- $image_meta = wp_get_attachment_metadata($attachment->ID);
- $image_width = $image_meta['width'];
- $image_height = $image_meta['height'];
- echo '<img src="' . $url . '" class="sidebar-img" width="' . $image_width . '" height="' . $image_height . '" alt="' . get_the_title() . ' - ' . get_bloginfo("name") . '" />';
- endif;
- ?>
- <div class="ym-cbox">
- <?php
- // Accessible Tabs (position above content) ###############################################################################
- // works with the plugin ACF and in this case (the_repeater_field + the_sub_field)
- if($tabs && $tabs_created && $tabs_position == 'above content') :
- if($tab_page_headline) echo '<h1>' . $tab_page_headline . '</h1>';
- include 'wp-content/themes/love/extras/tabs.php';
- endif;
- // Accessible Accordion (position above content) ##########################################################################
- // works with the plugin ACF and in this case (the_repeater_field + the_sub_field)
- if($accordion && $accordion_created && $accordion_position == 'above content') :
- if($accordion_page_headline) echo '<h1>' , $accordion_page_headline , '</h1>';
- include 'wp-content/themes/love/extras/accordion.php';
- endif;
- // Get all custom fields attached to this post and store them in an array (see functions.php and custom_fields.php)
- /*
- $custom_field_array = base_get_all_custom_fields();
- if( !empty($custom_field_array) ) {
- print_r($custom_field_array);
- }
- */
- // output of custom code for content (based on an option in the page setting 'Advanced Options'
- if($show_extra_content == true && $extra_content_position == 'top') echo $extra_content_content;
- // this here is the normal option without content filter
- if($extra_content) echo $extra_content;
- // special container - only on the homepage
- if($postID == $check_home) echo '<div class="home-content">';
- // START main content ######################################################################################################
- if (have_posts()) : while (have_posts()) : the_post();
- if(!$hide_content) : // if not deactivated by custom field
- the_content();
- endif;
- wp_reset_query(); // reset loop
- endwhile; endif;
- // Overview page for showing excerpts of pages / sub pages
- if ($overview_page) include 'wp-content/themes/love/extras/sub_pages_overview.php'; // Output for Overview Page - Subpages
- // checks the current page (ID case by case) and displays whatever is needed
- switch ($postID) {
- case $check_home :
- // homepage stuff
- break;
- // 'News' page
- case $news_page :
- include 'wp-content/themes/love/extras/latest-news.php';
- break;
- // 'Blog'
- case $blog_page :
- include 'wp-content/themes/love/extras/blog.php';
- break;
- // 'Links' page --> Category 'Social Media Links' [10] excluded!
- case $links_page :
- wp_list_bookmarks('title_before=<h2>&title_after=</h2>&exclude_category=10&category_before=<div class="separator"></div>&category_after=&before=<p><span class="verlinkung">&between=</span><br />&after=</p>&orderby=rating&order=DESC&category_orderby=name&show_description=1&show_images=0&class=verlinkungen');
- // alternative = plugin: link-library
- break;
- // 'Contact' page
- case $contact_page :
- // page with contact form and iphorm call
- if(function_exists('iphorm')) :
- if(!$form_id) echo iphorm(1);
- else echo iphorm($form_id);
- endif;
- if(function_exists('insert_cform')) :
- if(!$form_id) insert_cform('1');
- else insert_cform($form_id);
- endif;
- break;
- // 'Quotes' page
- case $quotes_page :
- // page with quotes from the 'Quotes/Reviews' section of the website
- $quotes_include = 'content'; // for later use in the quotes snippet
- include 'wp-content/themes/love/extras/quotes-snippet.php'; // include the file to handle latest quotes
- break;
- // Registration page
- case $reg_page :
- // event registration form and functions
- include 'wp-content/themes/love/extras/event-registration.php';
- break;
- // Newsletter handling
- case $newsletter_page :
- // here the form will be placed in the page (we use this variable to set a class for the form container)
- $location = "form-in-page";
- include 'wp-content/themes/love/extras/newsletter_handling.php';
- break;
- }
- // cforms forms (optional ID or default ID = 1)
- if($form == true && $postID != $contact_page && $postID != $reg_page) :
- if(function_exists('insert_cform')) :
- if(!$form_id) insert_cform('1');
- else insert_cform($form_id);
- endif;
- if(function_exists('iphorm')) :
- if(!$form_id) echo iphorm(1);
- else echo iphorm($form_id);
- endif;
- endif;
- // Special Admin Include - include document based on file name in cft
- if($admin_code_include) get_template_part('extras/' . $admin_code_include);
- // output of custom code for content (based on an option in the page setting 'Advanced Options'
- # if($show_extra_content == true && $extra_content_position == 'bottom') echo $extra_content_content;
- if($show_extra_content == true) echo $extra_content_content;
- // Tag Cloud ##############################################################################################################
- // currently inactive: tag cloud (animated flash or static html)
- if($show_tag_cloud && $tag_cloud_position == 'content') get_template_part('extras/tagcloud.php');
- // currently inactive: Tag Cloud for NextGen Gallery ###########################################################################################
- if($gallery_tags) :
- // shortcode output (is neccessary otherwise no picture is shown)
- $gallery = '[tagcloud]';
- $gallery = apply_filters('the_content', $gallery );
- echo '<div id="ngg-gallery-tagcloud">' , $gallery , '</div>';
- endif;
- // NextGen Gallery ID ###########################################################################################
- if($page_type == 'gallery' && $gallery_manually == false) :
- // shortcode output
- $gallery_sc = '[nggallery id=' . $gallery_id . ']';
- $gallery_sc = apply_filters('the_content', $gallery_sc );
- echo $gallery_sc;
- endif;
- // Page with Events ###########################################################################################
- if($page_type == 'events') :
- include 'wp-content/themes/love/events.php';
- endif;
- // Accessible Accordion (position below content) ##########################################################################
- // works with the plugin ACF and in this case (the_repeater_field + the_sub_field)
- if($accordion && $accordion_created && $accordion_position == 'below content') include 'wp-content/themes/love/extras/accordion.php';
- // Accessible Tabs (position below content) ###############################################################################
- // works with the plugin ACF and in this case (the_repeater_field + the_sub_field)
- if($tabs && $tabs_created && $tabs_position == 'below content') include 'wp-content/themes/love/extras/tabs.php';
- // Slideshow - position below the content ##############################################################################
- // works with the plugin ACF and in this case (the_repeater_field + the_sub_field)
- if($slideshow && $slideshow_type != 'big') :
- if($slideshow_ID == NULL) :
- echo '<strong style="color: red;">No slideshow ID set.</strong>';
- else :
- include 'wp-content/themes/love/extras/slideshow-snippet.php';
- endif;
- endif;
- // Content boxes - position below the content #########################################################################
- // works with the plugin ACF and in this case (the_repeater_field + the_sub_field)
- if($content_box_1 || $content_box_2) :
- include 'wp-content/themes/love/extras/boxes-snippet.php';
- endif;
- // embedding of youtube playlists (js/jquery.youtubeplaylist.js)
- // based on http://geckohub.com/jquery/youtubeplaylist/gallery.html
- if($youtube_playlist) :
- while( has_sub_field('yt_playlist') ) {
- $position = get_sub_field('yt_list_position');
- };
- if($position == 'bottom') echo do_shortcode('[sc-youtube-playlist]');
- endif;
- // if position of subpages is 'content bottom'
- if($subpages == true && $subpages_position == 'content bottom') :
- include 'wp-content/themes/love/extras/sub_pages_navigation.php'; // include the file to handle latest quotes
- endif;
- // comments in a page
- if($comments == true) comments_template( '', true );
- // close special container on homepage
- if($postID == $check_home) :
- // include 'wp-content/themes/love/extras/extra-box-snippet.php'; // local time and weather
- echo '</div>';
- endif;
- // facebook like, google+, twitter + share / bookmark
- // position is defined in the home page settings
- // position options: sidebar, content, footer, content-sidebar, content-footer, footer-sidebar
- if($deactivate_social_local == false): // show the items only if not deactivated for local dvelopment
- if($social_sharing_position == 'content' || $social_sharing_position == 'content-sidebar') :
- if(($social_sharing == 'yes') || ($social_features == 'yes')) include 'extras/social-features.php';
- endif;
- endif;
- ?>
- </div>
- </div>
- <?php
- if($sidebar) :
- ?>
- <div class="ym-col2">
- <?php
- // Slideshow - position above the content ###############################################################################
- // works with the plugin ACF and in this case (the_repeater_field + the_sub_field)
- if($slideshow_in_sidebar) :
- if($sidebar_slideshow_id == NULL) :
- echo '<strong style="color: red;">No slideshow ID set.</strong>';
- else :
- include 'wp-content/themes/love/extras/slideshow-snippet.php';
- endif;
- endif;
- // image for the sidebar (based on CTF)
- if($sidebar_image) :
- $postid = $sidebar_image;
- $attachment = get_post($postid);
- $url = wp_get_attachment_url($postid);
- $image_meta = wp_get_attachment_metadata($attachment->ID);
- $image_width = $image_meta['width'];
- $image_height = $image_meta['height'];
- echo '<img src="' . $url . '" class="sidebar-img" width="' . $image_width . '" height="' . $image_height . '" alt="' . get_the_title() . ' - ' . get_bloginfo("name") . '" />';
- endif;
- ?>
- <div class="ym-cbox">
- <?php
- // sidebar content for pages (extra column) ################3333###########################################################
- $count = 0; // counter for the sidebar array
- // contact information on registration page
- if($postID == $reg_page) :
- if($contact_info_events) :
- echo $contact_info_events;
- endif;
- endif;
- // Accessible Tabs (position above content) ###############################################################################
- // works with the plugin ACF and in this case (the_repeater_field + the_sub_field)
- if($tabs_sidebar && $tabs_created_sidebar && $tabs_position_sidebar == 'above content') :
- include 'wp-content/themes/love/extras/tabs.php'; // include the file to handle latest quotes
- endif;
- // counter for the $sidebar_array and $identifier
- $count = 0;
- $position = 0;
- // currently inactive: if position of subpages is 'right top'
- if($subpages == true && $subpages_position == 'right top') :
- ob_start();
- include 'wp-content/themes/love/extras/sub_pages_navigation.php'; // include the file to handle latest quotes
- $sidebar_array[$count] = ob_get_clean();
- $identifier[$position] = "subpages subpages-top"; // for separator css
- $count++;
- $position++;
- endif;
- // Events (which are reused in footer.php)
- if($events_in_sidebar == true) :
- // variable which helps to change output according to the include in the sidebar
- $event_include = 'sidebar'; // for later use in the event snippet
- $sidebar_array[$count] = '<h2>';
- $sidebar_array[$count].= $events_header_sidebar;
- $sidebar_array[$count].= '</h2>';
- ob_start();
- include 'wp-content/themes/love/extras/events-snippet.php';
- $sidebar_array[$count].= ob_get_clean();
- $identifier[$position] = "events"; // for separator css
- $count++;
- $position++;
- endif;
- // display contact information from a certain page (defined in the setting of the homepage and displayed from a page ID that is defined in that settings)
- if($display_contact == true) :
- $sidebar_array[$count] = $contact_info;
- if($contact_additional) $sidebar_array[$count].= $contact_additional;
- $identifier[$position] = "contact"; // for separator css
- $count++;
- $position++;
- endif;
- // include of latest-news-sidebar.php --> display news from cat
- if($news_in_sidebar == true) :
- ob_start();
- include 'wp-content/themes/love/extras/latest-news-sidebar.php'; // include the file to handle latest news
- $sidebar_array[$count] = ob_get_clean();
- $identifier[$position] = "news"; // for separator css
- $count++;
- $position++;
- endif;
- // if position of subpages is 'right bottom'
- if($subpages == true && $subpages_position == 'right bottom') :
- ob_start();
- include 'wp-content/themes/love/extras/sub_pages_navigation.php'; // include the file to handle latest quotes
- $sidebar_array[$count] = ob_get_clean();
- $identifier[$position] = "subpages-bottom"; // for separator css
- $count++;
- $position++;
- endif;
- // currently inactive
- // tag cloud (animated flash or static html)
- if($show_tag_cloud && $tag_cloud_position == 'right') :
- ob_start();
- include 'wp-content/themes/love/extras/tagcloud.php'; // include the file to handle latest quotes
- $sidebar_array[$count] = ob_get_clean();
- $identifier[$position] = "tagcloud"; // for separator css
- $count++;
- $position++;
- endif;
- // include of latest-quotes-sidebar.php --> display quotes/reviews/comments from cat
- if($quotes_in_sidebar == true) :
- // variable which helps to change output according to the include in the sidebar
- $quotes_include = 'sidebar'; // for later use in the quotes snippet
- ob_start();
- include 'wp-content/themes/love/extras/quotes-snippet.php'; // include the file to handle latest quotes
- $sidebar_array[$count] = ob_get_clean();
- $identifier[$position] = "quotes"; // for separator css
- $count++;
- $position++;
- endif;
- // display the newsletter sign-up form
- if($newsletterform_in_sidebar == 'yes') :
- ob_start();
- include 'wp-content/themes/love/extras/newsletter.php';
- $sidebar_array[$count] = ob_get_clean();
- $identifier[$position] = "newsletter"; // for separator css
- $count++;
- $position++;
- endif;
- ####################################
- ##################################
- ####################################
- ##################################
- # change conditions
- // social media - position right
- if($social_media_links && $social_media_link_page_pos == 'right' || $social_media_link_page_pos == 'both' && $deactivate_social_local == false) :
- $sidebar_array[$count] = '<h3>Social Media</h3><p class="social-links">' . $social_media_header . makeLinkList('Social Media','') . '</p>';
- $count++;
- endif;
- // if content set to display
- if($content_in_sidebar == 'yes' || $content_of_id) :
- // get content if id is set for displaying content of a particular page in the sidebar
- if($content_of_id) :
- $thepost = get_post( $content_of_id );
- $content = $thepost->post_content;
- $content = apply_filters('the_content', $content);
- $sidebar_array[$count] = $content;
- $identifier[$position] = "content-of-id"; // for separator css
- $count++;
- $position++;
- endif;
- // right column content output
- if($content_of_sidebar) :
- $sidebar_array[$count] = $content_of_sidebar;
- $identifier[$position] = "content-of-sidebar"; // for separator css
- $count++;
- $position++;
- endif;
- endif; // end if($content_in_sidebar)
- // current order of elements
- /*
- Tabs (wenn Einstellung 'über dem Text')
- Liste der Unterseiten (wenn Einstellung 'rechte Spalte oben')
- Inhalt einer anderen Seite
- Inhalt (normal)
- Kontakt
- News
- Liste der Unterseiten (wenn Einstellung 'rechte Spalte unten')
- Termine
- Zitate
- Newsletter
- Social Media Links
- Tabs (wenn Einstellung 'unter dem Inhalt')
- */
- // START sidebar output / right column #############################################################################################
- // check if sidebar respectively 'right column' is active
- if(is_array($sidebar_array) && count($sidebar_array) > 0) :
- // count elements in $sidebar_array
- $elements = count($sidebar_array);
- // manipulate the order if necessary
- $counter = 0;
- while (list(, $value) = each($sidebar_array)) {
- echo $value;
- if($counter < $elements - 1) :
- echo '<div class="separator after-' . $identifier[$counter] . ' before-' . $identifier[$counter + 1] .'"></div>';
- $counter++;
- endif;
- }
- endif;
- // Accessible Tabs (position below content) ###############################################################################
- // works with the plugin ACF and in this case (the_repeater_field + the_sub_field)
- if($tabs_sidebar && $tabs_created_sidebar && $tabs_position_sidebar == 'below content') :
- include 'wp-content/themes/love/extras/tabs.php';
- endif;
- // include of the sidebar for the blog
- if($postID == $blog_page) include 'wp-content/themes/love/extras/sidebar.php';
- ?>
- </div>
- </div>
- <?php
- // only when sidebar is needed
- endif;
- // FEATURED posts & content #############################################################################################
- // three aditional columns with extra content
- // currently available options (for each page): Upcoming Events, Blog Posts from Category (Featured)
- if($featured == TRUE) :
- $column_num = ($nav_type == 'top') ? '2' : '3';
- include 'wp-content/themes/love/extras/featured-content-cols.php';
- endif;
- // Wordpress Footer #########################################################################################################
- get_footer();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement