WordPress.org

Ready to get started?Download WordPress

Forums

News and page system (5 posts)

  1. wwe9112
    Member
    Posted 5 years ago #

    Is there a plugin or something that will allow me to place images next to my news posts like: http://www.wrestlingtruth.com .

    I like how he did that and wonder if there is a plugin for it. Also, how do I add a page, to show links to other pages in my blog? I think that would be cool as well...

    Thanks for your time.

    God Bless.

  2. wwe9112
    Member
    Posted 5 years ago #

    Anybody? Please help! I looked thought eh plugins too.

  3. mores
    Member
    Posted 5 years ago #

    It's more of a theme-design issue.

    You need to create a theme for your archive, or your home page, or whatever, that extracts post images.
    Then you write posts, upload images to that post, and the theme automatically puts the corresponding thumbnail next to the title.

    This thread is a good starter: http://wordpress.org/support/topic/140609?replies=43

    You'll need a bit of HTML and PHP knowledge.

  4. wwe9112
    Member
    Posted 5 years ago #

    OK, I will skip that image thing lol...I do know HTML and CSS though....What will the Excerpt Editor editor do? Will it do the thing where you put a discretion for the post, and when clicked it wont show up on the inner page? On the inner page the actual post is there and not where I put the page break thingy?

    Thanks for you help.

  5. mores
    Member
    Posted 5 years ago #

    Well if you know HTML, and you can identify PHP bits and HTML bits, then it's simple.

    1) create a blank php file, call it functions.php and save it in your theme directory.
    Fill it with

    <?php
    function postimage($size=medium) {
    	if ( $images = get_children(array(
    		'post_parent' => get_the_ID(),
    		'post_type' => 'attachment',
    		'numberposts' => 1,
    		'post_mime_type' => 'image',)))
    	{
    		foreach( $images as $image ) {
    			$attachmenturl=wp_get_attachment_url($image->ID);
    			$attachmentimage=wp_get_attachment_image( $image->ID, $size );
    
    			echo '<a href="'.$attachmenturl.'" rel="lightbox">'.$attachmentimage.'</a>';
    		}
    	} else {
    		echo "No Image";
    	}
    }
    ?>

    Then open up the file, where you wish to have the list of your posts.
    Depends on where you want it ... if it is the default view, it'll be in the index.php, of you want to leave the normal layout as it is and only have the category view like on the wrestling page, work in the category.php file.
    You need to tell us more about what you wish to do, or show us by posting a link to your site.

    Anyhow, wherever you want the list of posts to show up, you'll find something like this:

    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    
    	<div class="post" id="post-<?php the_ID(); ?>">
    		<div class="entry">
    			<?php the_title('<h1>&raquo; ', '</h1>'); ?>
    			<?php the_content('Read more »'); ?>
    		</div>
    		<p class="postmetadata"><?php edit_post_link('Edit','',''); ?> 
    
    	</div>
    
    <?php endwhile; ?>

    In a normal HTML editor, you'll see the difference between the php and html stuff.
    What this bit does is check if there are posts to be found, then display it in it's own div.

    Change the stuff above to the following:

    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    
    	<div class="post" id="post-<?php the_ID(); ?>">
    		<div class="entry">
    			<?php postimage('thumbnail') ?>
    			<?php the_title('<h1>&raquo; ', '</h1>'); ?>
    			<?php the_excerpt('Read more »'); ?>
    		</div>
    		<p class="postmetadata"><?php edit_post_link('Edit','',''); ?> 
    
    	</div>
    
    <?php endwhile; ?>

    We added the postimage(thumbnail) part. This will output the post thumbnail. Obviously, use your HTML / CSS skillz to format as you see fit ... like using a span align left to make it float on the left, or whatever.
    Easy ;)

Topic Closed

This topic has been closed to new replies.

About this Topic