Viewing 6 replies - 1 through 6 (of 6 total)
  • You need to have

    <?php the_title(); ?>

    wherever you want the title to appear :o)

    Thread Starter jkreisler

    (@jkreisler)

    Where would a post this? Within the post itself or do I post under one of the setting features?

    You’d put it right above the tags for category and date or below or wherever you want it to appear and format it to your liking. For instance mine looks like this:

    <p><span class="title" id="post-<?php the_ID(); ?>"><?php the_title(); ?></span><br />
    <small><?php the_time('l') ?> - <?php the_time('F jS Y') ?> - <?php the_time('g:i A'); ?></small></p>

    Thread Starter jkreisler

    (@jkreisler)

    I guess what i don’t understand is where do I find the main template that would modify all of the blog posts?

    Theme Editor
    Header?

    There isn’t a main template to modify everything. You’ll have to change them manually. Which ones to change depends on your theme. For me the files are archive.php, index.php, page.php, search.php and single.php. Go to wp-content/themes/YOUR THEME and check all the files to see which ones you’d want to add the title to.

    currently, i’m trying to replace how my blog post looks like on my main page. my homepage: https://www.josephsunga.com.

    on top of each post it shows the following:
    “joseph 7:09 am on July 8, 2008 | 0 | #”
    author name / time / date / comments / tags

    i’d like to basically replace the author name with the “post title” and move everything else under the “post title”.

    here is the code to the “main page template”:

    <?php
    if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == 'post' ) {
    	if ( ! is_user_logged_in() )
    		auth_redirect();
    
    	if( !current_user_can( 'publish_posts' ) ) {
    		wp_redirect( get_bloginfo( 'url' ) . '/' );
    		exit;
    	}
    
    	check_admin_referer( 'new-post' );
    
    	$user_id		= $current_user->user_id;
    	$post_content	= $_POST['posttext'];
    	$tags			= $_POST['tags'];
    
    	$char_limit		= 40;
    	$post_title		= strip_tags( $post_content );
    	if( strlen( $post_title ) > $char_limit ) {
    		$post_title = substr( $post_title, 0, $char_limit ) . ' ... ';
    	}
    
    	$post_id = wp_insert_post( array(
    		'post_author'	=> $user_id,
    		'post_title'	=> $post_title,
    		'post_content'	=> $post_content,
    		'tags_input'	=> $tags,
    		'post_status'	=> 'publish'
    	) );
    
    	wp_redirect( get_bloginfo( 'url' ) . '/' );
    	exit;
    }
    
    get_header( ); 
    
    if( current_user_can( 'publish_posts' ) ) {
    	require_once dirname( __FILE__ ) . '/post-form.php';
    }
    ?>
    
    <div id="main">
    	<h2>Latest Updates <a class="rss" href="<?php bloginfo( 'rss2_url' ); ?>">RSS</a></h2>
    	<ul>
    <?php
    if( have_posts( ) ) {
    
    	$previous_user_id = 0;
    	while( have_posts( ) ) {
    		the_post( );
    ?>
    
    <li id="prologue-<?php the_ID(); ?>" class="user_id_<?php the_author_ID( ); ?>">
    
    <?php
    		// Don't show the avatar if the previous post was by the same user
    		$current_user_id = get_the_author_ID( );
    		if( $previous_user_id !== $current_user_id ) {
    			echo prologue_get_avatar( $current_user_id, get_the_author_email( ), 48 );
    		}
    		$previous_user_id = $current_user_id;
    ?>
    
    	<h4>
    		<?php the_author_posts_link( ); ?>
    		<span class="meta">
    			<?php the_time( ); ?> on <?php the_time( 'F j, Y' ); ?> |
    			<?php comments_popup_link( __( '0' ), __( '1' ), __( '%' ) ); ?> |
    			<a href="<?php the_permalink( ); ?>">#</a> |
    			<?php edit_post_link( __( 'e' ) ); ?>
    			<br />
    			<?php the_tags( __( 'Tags: ' ), ', ', ' ' ); ?>
    		</span>
    	</h4>
    	<div class="postcontent">
    		<?php the_content( __( '(More ...)' ) ); ?>
    	</div> <!-- // postcontent -->
    	<div class="bottom_of_entry">&nbsp;</div>
    </li>
    
    <?php
    	} // while have_posts
    
    } // if have_posts
    ?>
    
    	</ul>
    
    	<div class="navigation"><p><?php posts_nav_link(); ?></p></div>
    
    </div> <!-- // main -->
    
    <?php
    get_footer( );

    please contact me at josephsunga (at) gmail (dot) com. thanks in advance!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Post Title’ is closed to new replies.