WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Add post to static home page (2 posts)

  1. johndove523
    Member
    Posted 1 year ago #

    Preface - Sorry, I searched the forum and found similar topics but not quite what I need here.

    Hi,

    Please see url http://informaticseducation.org.

    From a former site I built with help from an experienced WP designer, I copied and pasted some code from the template-homepage.php file into the site I'm currently working on (the link above). I created a post category, and the post is appearing on the page, but it's below the main (left) and sidebar content.

    template-homepage.php code: (see html comment in the middle, which is my question)

    <?php
    /*
    Template Name: Home
    */
    
    get_header(); ?>
    
    <?php
    if (have_posts()) :
    	while (have_posts()) :
    		the_post();
    		the_content();
    	endwhile;
    endif;
    ?>
    
    <!--the following code needs to be combined with the code above in order for the post to follow the content in the home_main (left) div but I don't know enough php to know how to assemble this code correctly-->
    
    <?php query_posts('showposts=3&cat=4'); ?>
    	<?php while (have_posts()) : the_post(); ?>
    	<div class="home-page-article">
    	<h3><?php the_title(); ?></h3>
    	<?php the_content(); ?>
    	</div>
    	<?php endwhile; ?>
    
    <?php get_footer(); ?>

    Related Note - I'm relatively new to WP, but I am trying to migrate to designing exclusively with WP. I would appreciate any suggestions that can teach me how to do more advanced things (like what I'm trying to do here). I don't find the Codex terribly helpful, in that it doesn't provide a lot of linear processes from start to finish; mostly just provides the pieces of the puzzle without full context. Can anyone recommend a book, video series, etc. that could help me with more advanced WP procedures and techniques? Thank you.

  2. johndove523
    Member
    Posted 1 year ago #

    I got what I needed here, thanks. Marking as resolved.

Topic Closed

This topic has been closed to new replies.

About this Topic