1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Wordpress posts on a page???

Discussion in 'Blogging' started by blackhatdamo, May 4, 2013.

  1. blackhatdamo

    blackhatdamo Registered Member

    Joined:
    Apr 6, 2012
    Messages:
    86
    Likes Received:
    27
    Location:
    A dark place
    Hi everyone I could do with a little help please.

    I would like to do this http://www.creativdesigns.com/blog/

    I want post snippets on a page that link to the full post that has its own page. How would I do this in wordpress?

    I have tried setting a static homepage in the settings>reading section, but doing this messes up the website so this isn't an option for me.

    I have also searched google for countless hours without any success :(

    I have tried:

    Code:
    <?php if (have_posts()) : while (have_posts()) : the_post();?>
    
    
    	<?php the_content(); ?>
    
    
    	<?php endwhile; endif; ?>
    
    and

    Code:
    <?php if(have_posts()): ?><?php while(have_posts()): the_post(); ?> >
    			<div class="post" id="post-<?php the_ID(); ?>">
    				<h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
    				<div class="entry">
    					<?php the_excerpt(); ?>
    
    
    
    both of these show what I have written on the blog page but dont show my posts at all

    the code in my blog.php file is

    Code:
    <?php
    /*
    Template Name: blog
    */
    ?>
    
    
    <?php get_header(); ?>
    
    
    <div class="row">
    				<div class="large-12 columns pad">
    
    
    			
    <?php if (have_posts()) : while (have_posts()) : the_post();?>
    <?php the_excerpt(); ?>
    <?php the_post(); ?>
    <?php endwhile; endif; ?>
    
    
    
    
    
    
    		</div>
    </div>
    				
    <?php get_footer(); ?>
    
    any help would be greatly appreciated as I am coming close to cracking now.

    Thanks in advance :)

    also if this is the wrong forum please can a mod move to the correct one ThankYou
     
  2. blackhatdamo

    blackhatdamo Registered Member

    Joined:
    Apr 6, 2012
    Messages:
    86
    Likes Received:
    27
    Location:
    A dark place
    As no one has replied i have a solution that works for the most part. So i'll post just in case others are having the same issue or something.

    in blog.php I have :

    Code:
    <ul>
    
    
    <?php
            $args = array( 'numberposts' => '10' );
        $recent_posts = wp_get_recent_posts( $args );
        foreach( $recent_posts as $recent ){
            echo '<li><a href="' . get_permalink($recent["ID"]) . '" title="Look '.$recent["post_title"].'"  >' .   $recent["post_title"].'</a> <br />' .$recent["post_excerpt"].' <br /></li> <br /> ';
    
    
        }
    ?>
    
    
    </ul>
    
    
    
    and in single.php I have:

    Code:
    <?php get_header(); ?>
    
    
    <?php if (have_posts()) : while (have_posts()) : the_post();?>
    
    
    	<?php the_content(); ?>
    
    
    	<?php endwhile; endif; ?>
    
    
    <?php get_footer(); ?>
    
    Hope this can help somebody else out :)