src/web/app/themes/atahualpa/functions/bfa_post_parts.php
changeset 0 505fe5249d9c
equal deleted inserted replaced
-1:000000000000 0:505fe5249d9c
       
     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']; ?>><?php
       
    38 			} else { ?>
       
    39 				<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e('Permanent Link to ','atahualpa') . the_title_attribute('echo=1') ?>">
       
    40 				<?php the_title(); ?></a></h<?php echo $bfa_ata['h_posttitle']; ?>><?php
       
    41 			}
       
    42 		echo $after;
       
    43 		return;
       
    44 	}
       
    45 //  Case 2 - 'Use Post / Page Options' is Yes, then use the BFA title
       
    46 	if ( is_single() OR is_page() ) {
       
    47 		$bfa_ata_body_title = get_post_meta($post->ID, 'bfa_ata_body_title', true);
       
    48 		$bfa_ata_display_body_title = get_post_meta($post->ID, 'bfa_ata_display_body_title', true);
       
    49 		$bfa_ata_body_title_multi = get_post_meta($post->ID, 'bfa_ata_body_title_multi', true);
       
    50 	} else {
       
    51 		$bfa_ata_body_title_multi = get_post_meta($post->ID, 'bfa_ata_body_title_multi', true);
       
    52 	}
       
    53 	
       
    54 	// Since 3.6.1: Display a link to the full post if there is no post title and the post is too short
       
    55 	// for a read more link.
       
    56 	
       
    57 	// some plugins hook into 'the_title()' so we only want it called once. But it must also be called 
       
    58 	// when using the bfa_ata titles so we use a dummy call:
       
    59 	//		$bfa_toss = the_title('','',false); 
       
    60 	// in those cases
       
    61 	$bfa_temp_title = get_the_title();
       
    62 	if ( $bfa_temp_title == '' ) { ?>
       
    63 		<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e('Permanent Link','atahualpa')?>">Permalink</a><?php 
       
    64 		
       
    65 	} elseif ( (!is_single() AND !is_page()) OR $bfa_ata_display_body_title == '' ) {
       
    66 		
       
    67 		echo $before; ?>
       
    68 		<h<?php echo $bfa_ata['h_posttitle']; ?>><?php 
       
    69 			
       
    70 		if( !is_single() AND !is_page() ) { ?>
       
    71 			<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e('Permanent Link to ','atahualpa') .  the_title_attribute('echo=1') ?>"><?php 
       
    72 		} 
       
    73 
       
    74 		if ( (is_single() OR is_page()) AND $bfa_ata_body_title != "" ) {
       
    75 			echo htmlentities($bfa_ata_body_title,ENT_QUOTES,'UTF-8');
       
    76 			$bfa_toss = the_title('','',false);
       
    77 		} else {
       
    78 			if ( $bfa_ata_body_title_multi != '' ) {
       
    79 				echo htmlentities($bfa_ata_body_title_multi,ENT_QUOTES,'UTF-8');  
       
    80 				$bfa_toss = the_title('','',false);
       
    81 			} else 
       
    82 				echo $bfa_temp_title; 
       
    83 		}
       
    84 
       
    85 		if ( !is_single() AND !is_page() ) { ?></a><?php } ?></h<?php echo $bfa_ata['h_posttitle']; ?>>
       
    86 		<?php echo $after;
       
    87 	}
       
    88 }
       
    89 
       
    90 
       
    91 
       
    92 
       
    93 function bfa_post_byline($before = '<div class="post-byline">', $after = '</div>') 
       
    94 {
       
    95 	global $bfa_ata, $post;
       
    96 	
       
    97     // don't display on WP Email pages
       
    98     if(intval(get_query_var('email')) != 1) {
       
    99     	
       
   100     	if( (is_home() AND $bfa_ata['post_byline_home'] != "") OR
       
   101     	(is_page() AND $bfa_ata['post_byline_page'] != "") OR
       
   102     	(is_single() AND $bfa_ata['post_byline_single'] != "") OR
       
   103     	( (is_archive() OR is_search() OR is_author() OR is_tag()) AND $bfa_ata['post_byline_multi'] != "") ) {
       
   104     		
       
   105     		echo $before;
       
   106 
       
   107 			if ( is_home() ) 		$bylinetype = 'post_byline_home'; 		
       
   108 			elseif ( is_page() ) 	$bylinetype = 'post_byline_page'; 
       
   109 			elseif ( is_single() )	$bylinetype = 'post_byline_single'; 
       
   110 			else 					$bylinetype = 'post_byline_multi'; 
       
   111 			
       
   112 			echo bfa_postinfo($bfa_ata[$bylinetype]);
       
   113 					
       
   114     		echo $after;
       
   115     	}
       
   116     }
       
   117 }
       
   118 
       
   119 						
       
   120 function bfa_post_bodycopy($before = '<div class="post-bodycopy clearfix">', $after = '</div>') 
       
   121 {
       
   122 	global $bfa_ata, $post, $bfa_pagetemplate_name, $bfa_pagetemplate_full_post_count, $bfa_ata_postcount;
       
   123 
       
   124 	$do_full_post = 0;
       
   125 	echo $before; 
       
   126 	if ((is_home()     AND $bfa_ata['excerpts_home'] == "Full Posts") 
       
   127 	OR  (is_home()     AND !is_paged() AND $bfa_ata_postcount <= $bfa_ata['full_posts_homepage']) 
       
   128 	OR  (is_category() AND $bfa_ata['excerpts_category'] == "Full Posts") 
       
   129 	OR  (is_date()     AND $bfa_ata['excerpts_archive'] == "Full Posts") 
       
   130 	OR  (is_tag()      AND $bfa_ata['excerpts_tag'] == "Full Posts") 
       
   131 	OR  (is_search()   AND $bfa_ata['excerpts_search'] == "Full Posts") 
       
   132 	OR  (is_author()   AND $bfa_ata['excerpts_author'] == "Full Posts") 
       
   133 	OR   is_single() 
       
   134 	OR   is_page() 
       
   135 	OR   function_exists('is_bbpress')
       
   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 ?>