WordPress.org

Ready to get started?Download WordPress

Forums

I'm trying to add "Author profile" to the code (1 post)

  1. karimova
    Member
    Posted 1 year ago #

    I'm trying to add possibility to have "Author profile" visible, apparently it doesnt work. Can somebody help me with code please?

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. ]

    <?php
    /*
    Template Name: Blog Home
    */
    ?>
    <?php get_header(); ?>
    
    						<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    							<h1><?php the_title(); ?></h1>
    
    							<div class="hr"></div>
    
    							<div class="column-66 first">
    
    								<?php
    									$published = wp_count_posts()->publish;
    									$perPage = (int)get_option($prefix."_blog_home_posts_per_page"); if ($perPage == 0) $perPage = 99999;
    									$curPage = (get_query_var('page')) ? (int)get_query_var('page') : 1;
    									$totPage = ceil($published / $perPage);
    									if ($curPage > $totPage) $curPage = $totPage;
    
    									$offset = ($curPage-1)*$perPage;
    									$recent_posts = wp_get_recent_posts( array( "numberposts" => (string)$perPage, "post_status" => "publish", "offset" => $offset ) );
    								?>
    
    								<?php echo the_content(); /* if there is content, echo it here, should just be background script shortcode though */ $isFirst = true; ?>
    
    								<?php foreach($recent_posts as $looppost) { $pid = $looppost["ID"]; $bp = get_page($pid) // loop to show posts ?>
    
    								<?php if (!$isFirst) { ?>
    								<div class="hr"></div>
    								<?php } $isFirst = false; ?>
    
    								<h3><a>"><?php echo get_the_title($pid); ?></a></h3>
    								<?php
    									if ( has_post_thumbnail($pid) ){
    										echo '<span class="blog-date-ribbon">';
    											echo '<span class="day">'.get_the_time('d',$pid).'</span>';
    											echo '<span class="month">'.get_the_time('M',$pid).'</span>';
    										echo '</span>';
    									echo '<p><a href="'.get_permalink($pid).'">';
    									echo get_the_post_thumbnail( $pid, 'post-thumbnail', array( 'class' => 'autosize', 'title' => get_the_title($pid) ) );
    									echo '</a><span class="clear"></span></p>'; }
    								?>
    								<?php
    									echo '<p class="post-list-excerpt">';
    									// if there's an excerpt use it
    									if (!empty($bp->post_excerpt)) { echo $bp->post_excerpt; }
    									// otherwise post the content if there's a <!--more--> tag and the first 200 chars of the content if not
    									else {
    									//	global $more;
    										// this doesn't work well in this case (not normal looping, using wp_get_recent_posts
    										// this isn't relevant since the template doesn't utilize the <!--more--> tag, it will be left in the
    										// search page since it hurts nothing...here some things need to be commented out though
    									/*	$more = 0; */ $gtc = $bp->post_content;
    									//	$more = 1; $gtc2 = $bp->post_content;
    									//	$noMoreTag = strlen($gtc)==strlen($gtc2);
    									//	if ($noMoreTag)
    									//	{
    											$gtcClean = strip_tags($gtc);
    											if (strlen($gtcClean) > 200)
    												echo '<p>'.substr($gtcClean, 0, 200).' [...]</p>';
    											else
    												echo $gtcClean;
    									//	}
    									//	else
    									//		echo $gtc;
    									}
    									echo '<p><a href="'.get_permalink($pid).'">'.stripslashes(get_option($prefix."_blog_readmore")).' →</a><span class="clear"></span></p>';
    									echo '</p>';
    								?>
    
    								<?php } // end of loop to show posts ?>
    
    								<div class="pagination">
    								<?php
    								if ($totPage > 1) {
    									echo '<div class="hr"></div>';
    									for ($i = 0; $i < $totPage; $i++) { // show pagination loop
    										$c = $i+1;
    										echo ($c == $curPage) ? "<span class='current'>$c</span>" : "<a href='".get_permalink()."?page=$c'>$c</a>";
    									} // end show pagination loop
    								} // end if show pagination statement
    								?>
    								</div>
    							</div>
    
    							<div class="column-33">
    								<?php get_sidebar(); ?>
    							</div>
    							<div class="clear"></div>
    
    						<?php endwhile; endif; ?>
    
    <?php get_footer(); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic