Advertisement
Guest User

Untitled

a guest
Feb 13th, 2013
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 9.31 KB | None | 0 0
  1. <?php
  2. function bfa_post_kicker($before = '<div class="post-kicker">', $after = '</div>')
  3. {
  4.     global $bfa_ata;
  5.    
  6.     // don't display on WP Email pages
  7.     if(intval(get_query_var('email')) != 1) {
  8.        
  9.         if( (is_home() AND $bfa_ata['post_kicker_home'] != "") OR
  10.         (is_page() AND $bfa_ata['post_kicker_page'] != "") OR
  11.         (is_single() AND $bfa_ata['post_kicker_single'] != "") OR
  12.         ( (is_archive() OR is_search() OR is_author() OR is_tag()) AND $bfa_ata['post_kicker_multi'] != "") ) {
  13.            
  14.             echo $before;
  15.            
  16.             if ( is_home() )        $kickertype = 'post_kicker_home';
  17.             elseif ( is_page() )    $kickertype = 'post_kicker_page';
  18.             elseif ( is_single() )  $kickertype = 'post_kicker_single';
  19.             else                    $kickertype = 'post_kicker_multi';
  20.            
  21.             echo bfa_postinfo($bfa_ata[$kickertype]);
  22.            
  23.             echo $after;       
  24.         }
  25.     }
  26. }
  27.  
  28. function bfa_post_headline($before = '<div class="post-headline">', $after = '</div>')
  29. {
  30.     global $bfa_ata, $post;
  31.  
  32. //  Case 1 - 'Use Post / Page Options' is no, then just use the post/page title
  33.     if ($bfa_ata['page_post_options'] == 'No') {
  34.         echo $before;
  35.         ?><h<?php echo $bfa_ata['h_posttitle']; ?>><?php
  36.             if ( is_single() OR is_page() ) {
  37.                 the_title(); ?></h><?php echo $bfa_ata['h_posttitle']; ?>
  38. <?php
  39.             } else { ?>
  40.                 <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e('','atahualpa') . the_title_attribute('echo=1') ?>">
  41.                 <?php the_title(); ?></a></h><?php echo $bfa_ata['h_posttitle']; ?><?php
  42.             }
  43.         echo $after;
  44.         return;
  45.     }
  46. //  Case 2 - 'Use Post / Page Options' is Yes, then use the BFA title
  47.     if ( is_single() OR is_page() ) {
  48.         $bfa_ata_body_title = get_post_meta($post->ID, 'bfa_ata_body_title', true);
  49.         $bfa_ata_display_body_title = get_post_meta($post->ID, 'bfa_ata_display_body_title', true);
  50.         $bfa_ata_body_title_multi = get_post_meta($post->ID, 'bfa_ata_body_title_multi', true);
  51.     } else {
  52.         $bfa_ata_body_title_multi = get_post_meta($post->ID, 'bfa_ata_body_title_multi', true);
  53.     }
  54.    
  55.     // Since 3.6.1: Display a link to the full post if there is no post title and the post is too short
  56.     // for a read more link.
  57.    
  58.     // some plugins hook into 'the_title()' so we only want it called once. But it must also be called
  59.     // when using the bfa_ata titles so we use a dummy call:
  60.     //      $bfa_toss = the_title('','',false);
  61.     // in those cases
  62.     $bfa_temp_title = get_the_title();
  63.     if ( $bfa_temp_title == '' ) { ?>
  64.         <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e('Permanent Link','atahualpa')?>">Permalink</a><?php
  65.        
  66.     } elseif ( (!is_single() AND !is_page()) OR $bfa_ata_display_body_title == '' ) {
  67.        
  68.         echo $before; ?>
  69.         <h<?php echo $bfa_ata['h_posttitle']; ?>><?php
  70.            
  71.         if( !is_single() AND !is_page() ) { ?>
  72.             <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e('','atahualpa') . the_title_attribute('echo=1') ?>"><?php
  73.         }
  74.  
  75.         if ( (is_single() OR is_page()) AND $bfa_ata_body_title != "" ) {
  76.             echo htmlentities($bfa_ata_body_title,ENT_QUOTES,'UTF-8');
  77.             $bfa_toss = the_title('','',false);
  78.         } else {
  79.             if ( $bfa_ata_body_title_multi != '' ) {
  80.                 echo htmlentities($bfa_ata_body_title_multi,ENT_QUOTES,'UTF-8');  
  81.                 $bfa_toss = the_title('','',false);
  82.             } else
  83.                 echo $bfa_temp_title;
  84.         }
  85.  
  86.         if ( !is_single() AND !is_page() ) { ?></a><?php } ?></h>
  87.         <?php echo $bfa_ata['h_posttitle']; ?><?php echo $after;
  88.     }
  89. }
  90.  
  91.  
  92.  
  93.  
  94. function bfa_post_byline($before = '<div class="post-byline">', $after = '</div>')
  95. {
  96.     global $bfa_ata, $post;
  97.    
  98.     // don't display on WP Email pages
  99.     if(intval(get_query_var('email')) != 1) {
  100.        
  101.         if( (is_home() AND $bfa_ata['post_byline_home'] != "") OR
  102.         (is_page() AND $bfa_ata['post_byline_page'] != "") OR
  103.         (is_single() AND $bfa_ata['post_byline_single'] != "") OR
  104.         ( (is_archive() OR is_search() OR is_author() OR is_tag()) AND $bfa_ata['post_byline_multi'] != "") ) {
  105.            
  106.             echo $before;
  107.  
  108.             if ( is_home() )        $bylinetype = 'post_byline_home';      
  109.             elseif ( is_page() )    $bylinetype = 'post_byline_page';
  110.             elseif ( is_single() )  $bylinetype = 'post_byline_single';
  111.             else                    $bylinetype = 'post_byline_multi';
  112.            
  113.             echo bfa_postinfo($bfa_ata[$bylinetype]);
  114.                    
  115.             echo $after;
  116.         }
  117.     }
  118. }
  119.  
  120.                        
  121. function bfa_post_bodycopy($before = '<div class="post-bodycopy clearfix">', $after = '</div>')
  122. {
  123.     global $bfa_ata, $post, $bfa_pagetemplate_name, $bfa_pagetemplate_full_post_count, $bfa_ata_postcount;
  124.  
  125.     $do_full_post = 0;
  126.     echo $before;
  127.     if ((is_home()     AND $bfa_ata['excerpts_home'] == "Full Posts")
  128.     OR  (is_home()     AND !is_paged() AND $bfa_ata_postcount <= $bfa_ata['full_posts_homepage'])
  129.     OR  (is_category() AND $bfa_ata['excerpts_category'] == "Full Posts")
  130.     OR  (is_date()     AND $bfa_ata['excerpts_archive'] == "Full Posts")
  131.     OR  (is_tag()      AND $bfa_ata['excerpts_tag'] == "Full Posts")
  132.     OR  (is_search()   AND $bfa_ata['excerpts_search'] == "Full Posts")
  133.     OR  (is_author()   AND $bfa_ata['excerpts_author'] == "Full Posts")
  134.     OR   is_single()
  135.     OR   is_page()
  136.     ) { $do_full_post = 1; }
  137.    
  138.     if (bfa_is_pagetemplate_active($bfa_pagetemplate_name)) {
  139.         if ($bfa_ata_postcount <= $bfa_pagetemplate_full_post_count)
  140.             { $do_full_post = 1; }
  141.         else
  142.             { $do_full_post = 0; }
  143.     }
  144.    
  145.     if ($do_full_post == 1) {
  146.         $bfa_ata_more_tag_final = str_replace("%post-title%", the_title('', '', false), $bfa_ata['more_tag']);
  147.         the_content($bfa_ata_more_tag_final);
  148.     } else {
  149.         if (function_exists('the_post_thumbnail') AND !function_exists('tfe_get_image')) {
  150.              if(has_post_thumbnail()): ?>
  151.                 <a href="<?php the_permalink() ?>"> <?php the_post_thumbnail(); ?></a>
  152.                 <?php endif;
  153.         }
  154.         the_excerpt();
  155.     }
  156.     echo $after;
  157. }
  158.  
  159.                        
  160. function bfa_post_pagination($before = '<p class="post-pagination"><strong>Pages:', $after = '</strong></p>')
  161. {
  162.     global $bfa_ata, $bfa_ata_postcount;
  163.    
  164.     if ((is_home()     AND $bfa_ata['excerpts_home'] == "Full Posts")
  165.     OR  (is_home()     AND !is_paged() AND $bfa_ata_postcount <= $bfa_ata['full_posts_homepage'])
  166.     OR  (is_category() AND $bfa_ata['excerpts_category'] == "Full Posts")
  167.     OR  (is_date()     AND $bfa_ata['excerpts_archive'] == "Full Posts")
  168.     OR  (is_tag()      AND $bfa_ata['excerpts_tag'] == "Full Posts")
  169.     OR  (is_search()   AND $bfa_ata['excerpts_search'] == "Full Posts")
  170.     OR  (is_author()   AND $bfa_ata['excerpts_author'] == "Full Posts")
  171.     OR  is_single()
  172.     OR is_page() ) {
  173.         wp_link_pages('before='.$before.'&after='.$after.'&next_or_number=number');
  174.     }
  175. }
  176.  
  177.  
  178. function bfa_archives_page($before = '<div class="archives-page">', $after = '</div>')
  179. {
  180.     global $bfa_ata, $wp_query;
  181.     $templateURI = get_template_directory_uri();
  182.    
  183.     $current_page_id = $wp_query->get_queried_object_id();
  184.    
  185.     if ( is_page() AND $current_page_id == $bfa_ata['archives_page_id'] ) {
  186.        
  187.         echo $before;              
  188.         if ( $bfa_ata['archives_date_show'] == "Yes" ) { ?>
  189.                 <h3><?php echo $bfa_ata['archives_date_title']; ?></h3>
  190.             <ul>
  191.             <?php wp_get_archives('type=' . $bfa_ata['archives_date_type'] . '&show_post_count=' .
  192.             ($bfa_ata['archives_date_count'] == "Yes" ? '1' : '0') . ($bfa_ata['archives_date_limit'] != "" ? '&limit=' .
  193.             $bfa_ata['archives_date_limit'] : '')); ?>
  194.             </ul>
  195.         <?php }                        
  196.         if ( $bfa_ata['archives_category_show'] == "Yes" ) { ?>
  197.             <h3><?php echo $bfa_ata['archives_category_title']; ?></h3>
  198.             <ul>
  199.             <?php wp_list_categories('title_li=&orderby=' . $bfa_ata['archives_category_orderby'] .
  200.             '&order=' . $bfa_ata['archives_category_order'] .
  201.             '&show_count=' . ($bfa_ata['archives_category_count'] == "Yes" ? '1' : '0') .
  202.             '&depth=' . $bfa_ata['archives_category_depth'] .
  203.             ($bfa_ata['archives_category_feed'] == "Yes" ? '&feed_image=' . $templateURI .
  204.             '/images/icons/feed.gif' : '')); ?>
  205.             </ul>
  206.         <?php }
  207.         echo $after;
  208.     }
  209. }
  210.  
  211.  
  212. function bfa_post_footer($before = '<div class="post-footer">', $after = '</div>')
  213. {
  214.     global $bfa_ata, $post;
  215.    
  216.     // don't display on WP Email pages
  217.     if(intval(get_query_var('email')) != 1) {
  218.        
  219.         if( (is_home() AND $bfa_ata['post_footer_home'] != "") OR
  220.         (is_page() AND $bfa_ata['post_footer_page'] != "") OR
  221.         (is_single() AND $bfa_ata['post_footer_single'] != "") OR
  222.         ( (is_archive() OR is_search() OR is_author() OR is_tag()) AND $bfa_ata['post_footer_multi'] != "") ) {
  223.            
  224.             echo $before;
  225.            
  226.             if ( is_home() )            $footertype = 'post_footer_home';
  227.             elseif ( is_page() )        $footertype = 'post_footer_page';
  228.             elseif ( is_single() )      $footertype = 'post_footer_single';
  229.             else                        $footertype = 'post_footer_multi';
  230.            
  231.             echo bfa_postinfo($bfa_ata[$footertype]);
  232.                    
  233.             echo $after;
  234.         }
  235.     }
  236. }
  237.  
  238.  
  239. function bfa_get_comments()
  240. {
  241.     global $bfa_ata;
  242.    
  243.     // Load Comments template (on single post pages, and "Page" pages, if set on options page)
  244.     if ( is_single() OR ( is_page() AND $bfa_ata['comments_on_pages'] == "Yes") ) {
  245.        
  246.         // don't display on WP-Email pages
  247.         if( intval(get_query_var('email')) != 1 ) {
  248.            
  249.             if ( function_exists('paged_comments') ) {
  250.                 // If plugin "Paged Comments" is activated, for WP 2.6 and older
  251.                 paged_comments_template();
  252.             } else {
  253.                 // This will load either legacy comments template (for WP 2.6 and older) or the new standard comments template (for WP 2.7 and newer)
  254.                 comments_template();
  255.             }
  256.         }
  257.     }
  258. }
  259. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement