Forums

The_Excerpt and images (8 posts)

  1. thispcneedshelp
    Member
    Posted 1 year ago #

    ok i have tryed the_expert and the_content but to NO avail. i had plugins to load images in expert as well. this is what i am trying to do.

    Parent page: the homepage content <-- this is where the customer puts content child paged to load in the home page.

    child page: home page block content 1 <-- this is where the customer creates ONE story with photos if needed

    child page: home page block content 2 <-- this is where the customer creates ONE story with photos if needed

    Customs template for homepage:

    <?php
    	/*
    		Template Name: Home Page
    	*/
    ?><?php get_header(); ?>
    
    		<div id="main-content">
    
    			<ul id="featured-articals">
    				<?php query_posts("posts_per_page=2&post_type=page&post_parent=57"); the_post(); ?>
                    <li>
    					<h3><?php the_title(); ?></h3>
    				  <?php the_excerpt(); ?>
    				</li>
    
    			</ul>
    
    		</div> <!-- END main-content -->
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>

    OK this code is to load the child pages one at a time for only the fist 2 child pages correct?

    Next i want to have the IMAGE in the post displayed as well. i have read you need plugins to do this. i have tried about 5 or 6 and gave up. for some reason the "the_excerpt" tag just will not pull the image. what i am ultimately looking for is i want only 25 words pulled from the page and placed on the home page WITH the image. I'm at a loss here today. i messed with this for 4.5 hours yesterday and can't figure it out.

    Can anyone help?

  2. thispcneedshelp
    Member
    Posted 1 year ago #

    PS and this code ONLY pulls ONE of the pages. not the TWO i have created as childs.

  3. thispcneedshelp
    Member
    Posted 1 year ago #

    ok got the images to work with "Advanced Excerpt" but i stilll cant get both pages to load on the homepage template. i just get the second page.

  4. alchymyth
    The Sweeper
    Posted 1 year ago #

    the loop is missing in the center of your code:

    <?php if( have_posts() ) : while( have_posts() ) : the_post(); ?>
    <li>
    					<h3><?php the_title(); ?></h3>
    				  <?php the_excerpt(); ?>
    				</li>
    <?php endwhile; endif; wp_reset_query(); ?>

    http://codex.wordpress.org/The_Loop

  5. thispcneedshelp
    Member
    Posted 1 year ago #

    ok but how do i loop it with my code? i'm a newbie and just loaded about 18 million of the same 2 pages.

  6. alchymyth
    The Sweeper
    Posted 1 year ago #

    try and remove $the_post(); from the end of you query line:

    this should look like:

    <?php query_posts("posts_per_page=2&post_type=page&post_parent=57"); ?>
    <?php if( have_posts() ) : while( have_posts() ) : the_post(); ?>
    <li>
    					<h3><?php the_title(); ?></h3>
    				  <?php the_excerpt(); ?>
    				</li>
    <?php endwhile; endif; wp_reset_query(); ?>
  7. thispcneedshelp
    Member
    Posted 1 year ago #

    ahhhh man that worked perfect. You are the MAN. well i hope your a man. if not you are the WO-MAN. thanks a million.

  8. alchymyth
    The Sweeper
    Posted 1 year ago #

    you are welcome.

    to be politically correct: HU-MAN
    name is Michael ;-)

Topic Closed

This topic has been closed to new replies.

About this Topic