Advertisement
endolil

page.php

Oct 16th, 2013
633
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 19.88 KB | None | 0 0
  1. <?php      
  2.     // get custom field informations ############################################################################################
  3.     include 'wp-content/themes/love/extras/custom_fields.php';
  4.    
  5.     // Redirects of pages #######################################################################################################
  6.    
  7.     // redirect to other website
  8.     if($redirection_selection == 'website' && $redirect != false) :
  9.         wp_redirect(clean_url($redirect), 301); // 301 means permanently
  10.         exit;
  11.     endif;
  12.    
  13.     // redirect to page
  14.     if($redirection_selection == 'page' && $redirect != false) :
  15.         wp_redirect($redirect, 301);  
  16.         exit;
  17.     endif;
  18.    
  19.     // redirection to first child page
  20.     if($redirection_selection == 'child' && $redirect == true) {
  21.         if (have_posts()) {
  22.             while (have_posts()) {
  23.                 the_post();
  24.                 $pagekids = get_pages("child_of=".$postID."&sort_column=menu_order");
  25.                 if ($pagekids) {
  26.                     $firstchild = $pagekids[0];
  27.                     $parent = ($post->post_parent) ? $post->post_parent : $postID;
  28.                     // redirect first child --> also possible: wp_redirect(get_permalink($parent->ID));
  29.                     wp_redirect(get_permalink($firstchild->ID), 301);
  30.                     exit;
  31.                 }
  32.             }
  33.         }
  34.     }
  35.    
  36.     // Wordpress Header #########################################################################################################
  37.     get_header();
  38.    
  39.     // only if activated in the settings of the 'homepage' (CFT)
  40.     if($show_edit_button == true) edit_post_link('','<div class="edit-post-link">','</div>');
  41.    
  42. ?>
  43. <div class="ym-column">
  44. <div class="ym-col1">
  45. <?php
  46.  
  47.     // Slideshow - position above the content     ###############################################################################
  48.     // works with the plugin ACF and in this case (the_repeater_field + the_sub_field)
  49.     if($slideshow && $slideshow_type == 'big') :
  50.         if($slideshow_ID == NULL) :
  51.             echo '<strong style="color: red;">No slideshow ID set.</strong>';
  52.         else : 
  53.             include 'wp-content/themes/love/extras/slideshow-snippet.php';
  54.         endif;
  55.     endif;
  56.    
  57.     // image for the top of the page (based on CTF)
  58.     if($content_image) :
  59.         $postid = $sidebar_image;
  60.         $attachment = get_post($postid);
  61.         $url = wp_get_attachment_url($postid);         
  62.         $image_meta = wp_get_attachment_metadata($attachment->ID);
  63.         $image_width = $image_meta['width'];
  64.         $image_height = $image_meta['height'];
  65.         echo '<img src="' . $url . '" class="sidebar-img" width="' . $image_width . '" height="' . $image_height . '" alt="' . get_the_title() . ' - ' . get_bloginfo("name") . '" />';
  66.     endif;
  67. ?>
  68.     <div class="ym-cbox">
  69. <?php      
  70.  
  71.     // Accessible Tabs  (position above content) ###############################################################################
  72.     // works with the plugin ACF and in this case (the_repeater_field + the_sub_field)
  73.     if($tabs && $tabs_created && $tabs_position == 'above content') :
  74.         if($tab_page_headline) echo '<h1>' . $tab_page_headline . '</h1>';
  75.         include 'wp-content/themes/love/extras/tabs.php';  
  76.     endif;
  77.    
  78.     // Accessible Accordion  (position above content) ##########################################################################
  79.     // works with the plugin ACF and in this case (the_repeater_field + the_sub_field)
  80.     if($accordion && $accordion_created && $accordion_position == 'above content') :
  81.         if($accordion_page_headline) echo '<h1>' , $accordion_page_headline , '</h1>';
  82.         include 'wp-content/themes/love/extras/accordion.php';
  83.     endif;
  84.    
  85.     // Get all custom fields attached to this post and store them in an array (see functions.php and custom_fields.php)
  86.     /*
  87.     $custom_field_array = base_get_all_custom_fields();
  88.     if( !empty($custom_field_array) ) {
  89.         print_r($custom_field_array);
  90.     }
  91.     */
  92.    
  93.     // output of custom code for content (based on an option in the page setting 'Advanced Options'
  94.     if($show_extra_content == true && $extra_content_position == 'top') echo $extra_content_content;
  95.    
  96.     // this here is the normal option without content filter
  97.     if($extra_content) echo $extra_content;
  98.    
  99.     // special container - only on the homepage
  100.     if($postID == $check_home) echo '<div class="home-content">';
  101.    
  102.     // START main content ######################################################################################################
  103.     if (have_posts()) : while (have_posts()) : the_post();
  104.             if(!$hide_content) : // if not deactivated by custom field
  105.                 the_content();
  106.             endif;
  107.             wp_reset_query(); // reset loop
  108.     endwhile; endif;
  109.  
  110.     // Overview page for showing excerpts of pages / sub pages
  111.     if ($overview_page) include 'wp-content/themes/love/extras/sub_pages_overview.php'; // Output for Overview Page - Subpages
  112.  
  113.     // checks the current page (ID case by case) and displays whatever is needed
  114.     switch ($postID) {
  115.  
  116.         case $check_home :
  117.             // homepage stuff
  118.         break;
  119.        
  120.         // 'News' page
  121.         case $news_page :
  122.             include 'wp-content/themes/love/extras/latest-news.php';
  123.         break;
  124.        
  125.         // 'Blog'
  126.         case $blog_page :
  127.             include 'wp-content/themes/love/extras/blog.php';
  128.         break;
  129.        
  130.         // 'Links' page --> Category 'Social Media Links' [10] excluded!
  131.         case $links_page :
  132.             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');
  133.             // alternative = plugin: link-library
  134.         break;
  135.        
  136.         // 'Contact' page
  137.         case $contact_page :
  138.             // page with contact form and iphorm call
  139.             if(function_exists('iphorm')) :
  140.                 if(!$form_id) echo iphorm(1);
  141.                 else echo iphorm($form_id);
  142.             endif;
  143.             if(function_exists('insert_cform')) :
  144.                 if(!$form_id) insert_cform('1');
  145.                 else insert_cform($form_id);
  146.             endif;
  147.         break; 
  148.        
  149.         // 'Quotes' page
  150.         case $quotes_page :
  151.             // page with quotes from the 'Quotes/Reviews' section of the website
  152.             $quotes_include = 'content'; // for later use in the quotes snippet
  153.             include 'wp-content/themes/love/extras/quotes-snippet.php';     // include the file to handle latest quotes
  154.         break; 
  155.        
  156.         // Registration page
  157.         case $reg_page :
  158.             // event registration form and functions
  159.             include 'wp-content/themes/love/extras/event-registration.php';            
  160.         break;
  161.        
  162.         // Newsletter handling
  163.         case $newsletter_page :
  164.             // here the form will be placed in the page (we use this variable to set a class for the form container)
  165.             $location = "form-in-page";
  166.             include 'wp-content/themes/love/extras/newsletter_handling.php';               
  167.         break;
  168.     }
  169.        
  170.     // cforms forms (optional ID or default ID = 1)
  171.     if($form == true && $postID != $contact_page && $postID != $reg_page) :
  172.         if(function_exists('insert_cform')) :
  173.             if(!$form_id) insert_cform('1');
  174.             else insert_cform($form_id);
  175.         endif;
  176.         if(function_exists('iphorm')) :
  177.             if(!$form_id) echo iphorm(1);
  178.             else echo iphorm($form_id);
  179.         endif;
  180.     endif;
  181.        
  182.     // Special Admin Include - include document based on file name in cft
  183.     if($admin_code_include) get_template_part('extras/' . $admin_code_include);
  184.        
  185.     // output of custom code for content (based on an option in the page setting 'Advanced Options'
  186.     # if($show_extra_content == true && $extra_content_position == 'bottom') echo $extra_content_content;
  187.     if($show_extra_content == true) echo $extra_content_content;
  188.    
  189.     // Tag Cloud  ##############################################################################################################
  190.    
  191.     // currently inactive: tag cloud (animated flash or static html)
  192.     if($show_tag_cloud && $tag_cloud_position == 'content') get_template_part('extras/tagcloud.php');
  193.  
  194.     // currently inactive: Tag Cloud for NextGen Gallery ###########################################################################################
  195.     if($gallery_tags) :
  196.         // shortcode output (is neccessary otherwise no picture is shown)
  197.         $gallery = '[tagcloud]';
  198.         $gallery = apply_filters('the_content', $gallery );
  199.         echo '<div id="ngg-gallery-tagcloud">' , $gallery , '</div>';
  200.     endif;
  201.    
  202.     // NextGen Gallery ID ###########################################################################################
  203.     if($page_type == 'gallery'  && $gallery_manually == false) :
  204.         // shortcode output
  205.         $gallery_sc = '[nggallery id=' . $gallery_id . ']';
  206.         $gallery_sc = apply_filters('the_content', $gallery_sc );
  207.         echo $gallery_sc;
  208.     endif; 
  209.    
  210.     // Page with Events ###########################################################################################
  211.     if($page_type == 'events') :
  212.         include 'wp-content/themes/love/events.php';
  213.     endif; 
  214.    
  215.     // Accessible Accordion  (position below content) ##########################################################################
  216.     // works with the plugin ACF and in this case (the_repeater_field + the_sub_field)
  217.     if($accordion && $accordion_created && $accordion_position == 'below content') include 'wp-content/themes/love/extras/accordion.php';
  218.    
  219.     // Accessible Tabs  (position below content) ###############################################################################
  220.     // works with the plugin ACF and in this case (the_repeater_field + the_sub_field)
  221.     if($tabs && $tabs_created && $tabs_position == 'below content') include 'wp-content/themes/love/extras/tabs.php';
  222.    
  223.     // Slideshow - position below the content     ##############################################################################
  224.     // works with the plugin ACF and in this case (the_repeater_field + the_sub_field)
  225.     if($slideshow && $slideshow_type != 'big') :
  226.         if($slideshow_ID == NULL) :
  227.             echo '<strong style="color: red;">No slideshow ID set.</strong>';
  228.         else : 
  229.             include 'wp-content/themes/love/extras/slideshow-snippet.php';
  230.         endif;
  231.     endif;
  232.    
  233.     // Content boxes - position below the content     #########################################################################
  234.     // works with the plugin ACF and in this case (the_repeater_field + the_sub_field)
  235.     if($content_box_1 || $content_box_2) :
  236.         include 'wp-content/themes/love/extras/boxes-snippet.php';
  237.     endif;
  238.    
  239.     // embedding of youtube playlists (js/jquery.youtubeplaylist.js)
  240.     // based on http://geckohub.com/jquery/youtubeplaylist/gallery.html
  241.     if($youtube_playlist) :
  242.         while( has_sub_field('yt_playlist') ) {
  243.             $position = get_sub_field('yt_list_position');
  244.         };
  245.         if($position == 'bottom') echo do_shortcode('[sc-youtube-playlist]');
  246.     endif;
  247.    
  248.     // if position of subpages is 'content bottom'
  249.     if($subpages == true && $subpages_position == 'content bottom') :
  250.         include 'wp-content/themes/love/extras/sub_pages_navigation.php';       // include the file to handle latest quotes
  251.     endif;
  252.    
  253.     // comments in a page
  254.     if($comments == true) comments_template( '', true );
  255.    
  256.     // close special container on homepage
  257.     if($postID == $check_home) :
  258.         // include 'wp-content/themes/love/extras/extra-box-snippet.php';       // local time and weather
  259.         echo '</div>';
  260.     endif;
  261.    
  262.     // facebook like, google+, twitter + share / bookmark
  263.     // position is defined in the home page settings
  264.     // position options: sidebar, content, footer, content-sidebar, content-footer, footer-sidebar
  265.     if($deactivate_social_local == false): // show the items only if not deactivated for local dvelopment
  266.         if($social_sharing_position == 'content' || $social_sharing_position == 'content-sidebar') :
  267.             if(($social_sharing == 'yes') || ($social_features == 'yes')) include 'extras/social-features.php';
  268.         endif;
  269.     endif;
  270. ?>
  271.     </div>
  272. </div>
  273. <?php
  274.     if($sidebar) :
  275. ?>
  276. <div class="ym-col2">
  277. <?php
  278.  
  279.     // Slideshow - position above the content     ###############################################################################
  280.     // works with the plugin ACF and in this case (the_repeater_field + the_sub_field)
  281.     if($slideshow_in_sidebar) :
  282.         if($sidebar_slideshow_id == NULL) :
  283.             echo '<strong style="color: red;">No slideshow ID set.</strong>';
  284.         else : 
  285.             include 'wp-content/themes/love/extras/slideshow-snippet.php';
  286.         endif;
  287.     endif;
  288.    
  289.     // image for the sidebar (based on CTF)
  290.     if($sidebar_image) :
  291.         $postid = $sidebar_image;
  292.         $attachment = get_post($postid);
  293.         $url = wp_get_attachment_url($postid);         
  294.         $image_meta = wp_get_attachment_metadata($attachment->ID);
  295.         $image_width = $image_meta['width'];
  296.         $image_height = $image_meta['height'];
  297.         echo '<img src="' . $url . '" class="sidebar-img" width="' . $image_width . '" height="' . $image_height . '" alt="' . get_the_title() . ' - ' . get_bloginfo("name") . '" />';
  298.     endif;
  299. ?>
  300.     <div class="ym-cbox">
  301. <?php
  302.  
  303.     // sidebar content for pages (extra column)  ################3333###########################################################
  304.     $count = 0; // counter for the sidebar array
  305.    
  306.     // contact information on registration page
  307.     if($postID == $reg_page) :
  308.         if($contact_info_events) :
  309.             echo $contact_info_events;
  310.         endif;
  311.     endif;
  312.    
  313.     // Accessible Tabs  (position above content) ###############################################################################
  314.     // works with the plugin ACF and in this case (the_repeater_field + the_sub_field)
  315.    
  316.     if($tabs_sidebar && $tabs_created_sidebar && $tabs_position_sidebar == 'above content') :
  317.         include 'wp-content/themes/love/extras/tabs.php';       // include the file to handle latest quotes
  318.     endif;
  319.        
  320.     // counter for the $sidebar_array and $identifier
  321.     $count = 0;
  322.     $position = 0;
  323.    
  324.     // currently inactive: if position of subpages is 'right top'
  325.     if($subpages == true && $subpages_position == 'right top') :
  326.         ob_start();
  327.         include 'wp-content/themes/love/extras/sub_pages_navigation.php';       // include the file to handle latest quotes
  328.         $sidebar_array[$count] = ob_get_clean();
  329.         $identifier[$position] = "subpages subpages-top"; // for separator css
  330.         $count++;
  331.         $position++;
  332.     endif;
  333.    
  334.     // Events (which are reused in footer.php)
  335.     if($events_in_sidebar == true) :
  336.         // variable which helps to change output according to the include in the sidebar
  337.         $event_include = 'sidebar'; // for later use in the event snippet
  338.         $sidebar_array[$count] = '<h2>';
  339.         $sidebar_array[$count].= $events_header_sidebar;
  340.         $sidebar_array[$count].= '</h2>';
  341.         ob_start();
  342.         include 'wp-content/themes/love/extras/events-snippet.php';
  343.         $sidebar_array[$count].= ob_get_clean();
  344.         $identifier[$position] = "events"; // for separator css
  345.         $count++;
  346.         $position++;
  347.     endif;
  348.        
  349.     // 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)  
  350.     if($display_contact == true) :
  351.         $sidebar_array[$count] = $contact_info;
  352.         if($contact_additional) $sidebar_array[$count].= $contact_additional;
  353.         $identifier[$position] = "contact"; // for separator css
  354.         $count++;
  355.         $position++;
  356.     endif;
  357.    
  358.     // include of latest-news-sidebar.php --> display news from cat
  359.     if($news_in_sidebar == true) :
  360.         ob_start();
  361.         include 'wp-content/themes/love/extras/latest-news-sidebar.php';        // include the file to handle latest news
  362.         $sidebar_array[$count] = ob_get_clean();
  363.         $identifier[$position] = "news"; // for separator css
  364.         $count++;
  365.         $position++;
  366.     endif;
  367.    
  368.     // if position of subpages is 'right bottom'
  369.     if($subpages == true && $subpages_position == 'right bottom') :
  370.         ob_start();
  371.         include 'wp-content/themes/love/extras/sub_pages_navigation.php';       // include the file to handle latest quotes
  372.         $sidebar_array[$count] = ob_get_clean();
  373.         $identifier[$position] = "subpages-bottom"; // for separator css
  374.         $count++;
  375.         $position++;
  376.     endif;
  377.    
  378.     // currently inactive
  379.     // tag cloud (animated flash or static html)
  380.     if($show_tag_cloud && $tag_cloud_position == 'right') :
  381.         ob_start();
  382.         include 'wp-content/themes/love/extras/tagcloud.php';       // include the file to handle latest quotes
  383.         $sidebar_array[$count] = ob_get_clean();
  384.         $identifier[$position] = "tagcloud"; // for separator css
  385.         $count++;
  386.         $position++;
  387.     endif;
  388.    
  389.     // include of latest-quotes-sidebar.php --> display quotes/reviews/comments from cat
  390.     if($quotes_in_sidebar == true) :
  391.         // variable which helps to change output according to the include in the sidebar
  392.         $quotes_include = 'sidebar'; // for later use in the quotes snippet
  393.         ob_start();
  394.         include 'wp-content/themes/love/extras/quotes-snippet.php';     // include the file to handle latest quotes
  395.         $sidebar_array[$count] = ob_get_clean();
  396.         $identifier[$position] = "quotes"; // for separator css
  397.         $count++;
  398.         $position++;
  399.     endif;
  400.    
  401.     // display the newsletter sign-up form
  402.     if($newsletterform_in_sidebar == 'yes') :
  403.         ob_start();
  404.         include 'wp-content/themes/love/extras/newsletter.php';
  405.         $sidebar_array[$count] = ob_get_clean();
  406.         $identifier[$position] = "newsletter"; // for separator css
  407.         $count++;
  408.         $position++;
  409.     endif;
  410.     ####################################
  411.     ##################################
  412.     ####################################
  413.     ##################################
  414.     # change conditions
  415.     // social media - position right
  416.     if($social_media_links && $social_media_link_page_pos == 'right' || $social_media_link_page_pos == 'both' && $deactivate_social_local == false) :
  417.         $sidebar_array[$count] = '<h3>Social Media</h3><p class="social-links">' . $social_media_header . makeLinkList('Social Media','') . '</p>';
  418.         $count++;
  419.     endif;
  420.    
  421.     // if content set to display
  422.     if($content_in_sidebar == 'yes' || $content_of_id) :
  423.         // get content if id is set for displaying content of a particular page in the sidebar
  424.         if($content_of_id) :
  425.             $thepost = get_post( $content_of_id );
  426.             $content = $thepost->post_content;
  427.             $content = apply_filters('the_content', $content);
  428.             $sidebar_array[$count] = $content;
  429.             $identifier[$position] = "content-of-id"; // for separator css
  430.             $count++;
  431.             $position++;
  432.         endif;
  433.            
  434.         // right column content output
  435.         if($content_of_sidebar) :
  436.             $sidebar_array[$count] = $content_of_sidebar;
  437.             $identifier[$position] = "content-of-sidebar"; // for separator css
  438.             $count++;
  439.             $position++;
  440.         endif;
  441.        
  442.     endif; // end if($content_in_sidebar)
  443.    
  444.     // current order of elements
  445.     /*
  446.     Tabs (wenn Einstellung 'über dem Text')
  447.     Liste der Unterseiten (wenn Einstellung 'rechte Spalte oben')
  448.     Inhalt einer anderen Seite
  449.     Inhalt (normal)
  450.     Kontakt
  451.     News
  452.     Liste der Unterseiten (wenn Einstellung 'rechte Spalte unten')
  453.     Termine
  454.     Zitate 
  455.     Newsletter
  456.     Social Media Links
  457.     Tabs (wenn Einstellung 'unter dem Inhalt')
  458.     */
  459.  
  460.     // START sidebar output / right column #############################################################################################
  461.     // check if sidebar respectively 'right column' is active
  462.     if(is_array($sidebar_array) && count($sidebar_array) > 0) :
  463.  
  464.         // count elements in $sidebar_array
  465.         $elements = count($sidebar_array);
  466.         // manipulate the order if necessary
  467.         $counter = 0;
  468.         while (list(, $value) = each($sidebar_array)) {
  469.             echo $value;
  470.             if($counter < $elements - 1) :
  471.                 echo '<div class="separator after-' . $identifier[$counter] . ' before-' . $identifier[$counter + 1] .'"></div>';
  472.                 $counter++;
  473.             endif;
  474.         }
  475.     endif;
  476.    
  477.     // Accessible Tabs  (position below content) ###############################################################################
  478.     // works with the plugin ACF and in this case (the_repeater_field + the_sub_field)
  479.     if($tabs_sidebar && $tabs_created_sidebar && $tabs_position_sidebar == 'below content') :
  480.         include 'wp-content/themes/love/extras/tabs.php';
  481.     endif;
  482.    
  483.     // include of the sidebar for the blog
  484.     if($postID == $blog_page) include 'wp-content/themes/love/extras/sidebar.php';
  485. ?> 
  486.     </div>
  487. </div>
  488. <?php
  489.     // only when sidebar is needed 
  490.     endif;
  491.    
  492.     // FEATURED posts & content #############################################################################################
  493.     // three aditional columns with extra content
  494.     // currently available options (for each page): Upcoming Events, Blog Posts from Category (Featured)
  495.     if($featured == TRUE) :
  496.         $column_num = ($nav_type == 'top') ?  '2' : '3';
  497.         include 'wp-content/themes/love/extras/featured-content-cols.php';
  498.     endif;
  499.  
  500.     // Wordpress Footer #########################################################################################################  
  501.     get_footer();
  502. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement