• I’ve been trying to customize a theme through trial and error, stress the word error as I’m pretty new to wordpress. Anyway, after looking at “the loop” I see that the following code handles Titles:

    <!– Display the Title as a link to the Post’s permalink. –>
    <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>

    If I have a textarea on the write panel what should the code look like for it so that the above code will pull the string of data and display it in the post? I’m assuming the textarea name of the string will have to be called by the above code right? Or no? I know I may not have expressed that in the technically most correct way but I did my best.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Difficult to understand what you want from reading the above however if you are looking to display the content of a post then you need to call the following code in your template files:

    <?php the_content(); ?>

    That will display the stuff you put in the post content when writing a post/page.

    Thread Starter gemanshi

    (@gemanshi)

    Sorry about that. To clarify, I’m trying to modify the prologue theme to fit my needs and want to add a title field. I assume that the following portion of the index file is where I need to be working:

    $_POST['action'] == 'post' ) {
    	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'];

    I tried to add $post_title = $_POST['posttitle'] and a few variations but to no avail. The “posttitle” is the name of the string I made in a textarea on the post-form.

    I might not be even close with the above attempt since like I said, this is totally trial and error but it seemed to be a possible solution. If you have any other suggestions, I really appreciate. Thanks for the response too!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Adding a Title to post content’ is closed to new replies.