• Hello! Please anyone help me with this issue! I’ve been searching for hours for some help but couldn’t find anything that would help me.. I’m trying to figure it out how to create a div on my static page which will display my latest posts (for instance3 latest posts).
    Thank you for your help!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter orgspirit

    (@orgspirit)

    chino29
    I don’t really understand where each code goes?
    Please help me with this. If I understand right I have to put first code to the main index.php at the top, and then I confused.. I’ve tried few variation but none of them really worked..((
    Here is my index.php with code added:

    php
    	// Include WordPress
    	define('WP_USE_THEMES', false);
    	// Change path below to location of wp-blog-header.php on server
    	require('/home/username/public_html/blog/wp-blog-header.php');
    	// Change number below to show 1 or more post excerpts
    	query_posts('showposts=1');
    ?>
    
    <?php get_header(); global $wp_theme_options; ?>
    <?php do_action('before_content'); ?>
    
    <!--index.php-->
    
    <div class="<?php do_action('content_style'); ?>" id="content">
    
    	<?php if (have_posts()) : while (have_posts()) : the_post(); // the loop ?>
    
    	<!--Post Wrapper Class-->
    	<div <?php if (function_exists('post_class')) { post_class(); } else { echo 'class="post"'; } ?>>
    
    	<!--Title/Date/Meta-->
    	<div class="title wrap">
    		<div class="date">
    			<div class="month"><?php the_time('M'); ?></div>
    			<div class="day"><?php the_time('d'); ?></div>
    		</div>
    		<div class="post-title">
    			<h3 id="post-<?php the_ID(); ?>">" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></h3>
    			By
    			<span class="meta-author"><?php the_author_posts_link(); ?></span>
    			 ·  Comments
    			<span class="meta-comments"><?php comments_popup_link('(0)', '(1)', '(%)'); ?></span>
    		</div>
    	</div>
    
    	<!--post text with the read more link-->
    	<?php the_content('Read More→'); ?>
    
    	<!--post meta info-->
    	<div class="meta-bottom wrap">
    		<div class="alignleft"><span class="categories">Categories : <?php the_category(', ') ?></span></div>
    		<div class="alignright"><span class="comments">Comments <?php comments_popup_link('(0)', '(1)', '(%)'); ?></span></div>
    	</div>
    
    	</div><!--end .post-->
    
    	<?php endwhile; // end of one post ?>
    
        <!-- Previous/Next page navigation -->
        <div class="paging clearfix">
    	    <div class="alignleft"><?php previous_posts_link('« Previous Page') ?></div>
    	    <div class="alignright"><?php next_posts_link('Next Page »') ?></div>
        </div>    
    
    	<?php else : // do not delete ?>
    
    	<div class="post">
    	<h3><?php _e("Page not Found"); ?></h3>
        <p><?php _e("We're sorry, but the page you're looking for isn't here."); ?></p>
        <p><?php _e("Try searching for the page you are looking for or using the navigation in the header or sidebar"); ?></p>
        </div>
    
    	<?php endif; // do not delete ?>
    
    </div><!--end #content-->
    
    <?php do_action('after_content'); ?>
    <?php get_footer(); //Include the Footer ?>
    

    Thank you for your help!

    you put the code in your themes index.php file. I am not telling this. Don’t change the theme’s index.php file. You put the code in your static customize php file (which will be exist outside the WP). Also you chnage this path /home/username/public_html/blog/wp-blog-header.php. like ./wp-blog-header.php or [folder_name]/wp-blog-header.php.

    Hope you understand that.

    Thread Starter orgspirit

    (@orgspirit)

    So I can’t add such feature to the WP theme? I really new to php and wordpress, sorry if I don’t understand simple things..But I want to ask about (static customize php)? Do I have to create new php file and upload to the root directory of my domain folder? What name I have to give it? Or it have to be my home page index.php file outside the WP?
    Thanks in advance!

    Thread Starter orgspirit

    (@orgspirit)

    Any one?

    Thread Starter orgspirit

    (@orgspirit)

    Could any one help me with this??please!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Make div on static page for latest post’ is closed to new replies.