WordPress.org

Ready to get started?Download WordPress

Forums

Help with the excerpt funtion (3 posts)

  1. mxpimp47
    Member
    Posted 4 years ago #

    here's what I'm trying to do... I have implemented a featured post section called "latest media". i have the image aligned and linked to a post. but i want to use the excerpt for the title of the image. as you can see in the testing template I'm using i cant seem to keep it aligned with the image above or below. can anyone tell me how to style the function so its in the list with the image? i have tried working with the php but i don't know enough to be able to make it happen.

    maybe there is another way to achieve what i am trying to do!

    thanks in advance for any help.

    link http://02f16cc.netsolhost.com/freestonemx/

  2. Quincy
    Member
    Posted 4 years ago #

    By quickly playing with this in FF using Firebug, it seems you can update the following styles to:

    .featured_img {
    display:block;
    max-width:200px;
    min-height:3em;
    }
    
    .carousel p {
    display:block;
    margin:0 0 0 5px;
    max-width:200px;
    min-height:3em;
    }

    I removed the float:left and added a margin for alignment. Also increased the max-width to 200px since it was set to 180px and the image is 200px wide... this causes the styles for margins etc to align everything with the 180px width defined div. Now it's aligned below the image (in firefox).

    One other suggestion (if this will be querying multiple posts with the image and title caption)...

    Place the <p>Freestone National Recap 2009</p> inside the

  3. tags after the <div class="featured_img"></div>. This way it'll hold it's structure if multiple posts will be displayed in your ul tags

    example:

    <ul class="carousel">  
    
    <li>
    <div class="featured_img"><a title="Freestone National Recap 2009" href="http://02f16cc.netsolhost.com/freestonemx/2010/05/14/freestone-national-recap-2009/"><img alt="Freestone National Recap 2009" src="wp-content/uploads/2010/07/freestone_recap1.jpg"></a></div>
    <p>Freestone National Recap 2009</p>
    </li>
    
    <li>
    <div class="featured_img"><a title="Freestone National Recap 2009" href="http://02f16cc.netsolhost.com/freestonemx/2010/05/14/freestone-national-recap-2009/"><img alt="Freestone National Recap 2009" src="wp-content/uploads/2010/07/freestone_recap1.jpg"></a></div>
    <p>Post 2</p>
    </li>
    
    <li>
    <div class="featured_img"><a title="Freestone National Recap 2009" href="http://02f16cc.netsolhost.com/freestonemx/2010/05/14/freestone-national-recap-2009/"><img alt="Freestone National Recap 2009" src="wp-content/uploads/2010/07/freestone_recap1.jpg"></a></div>
    <p>Post 3</p>
    </li>
    
    </ul>

    You may need to adjust your CSS slightly after that change but should help you avoid future headaches...

  • mxpimp47
    Member
    Posted 4 years ago #

    thank you for your help! maybe i need to explain a lil more detail. i would like the posts to be floated left 3 across. just 2 rows. i can make the content display exactly how you were saying. but with the following errors.

    i posted it like it was because it was actually showing the excerpt of the post (just not aligned) using the wordpress codex excerpt $post-->the_excerpt(); if i place it between the tags it looks like it does now if you look at it http://02f16cc.netsolhost.com/freestonemx/ .

    the problem i couldnt figure out was how to use that excerpt line of code so it displays it dynamically. when you look at it in firebug its hows the excerpt in p tags. so targeting the p tag wasnt working for me before i posted the question (i tried everything i could think of).

    maybe there is a better way to do this. could i do a special section of posts from a category? i believe so, i just have to look into how to implement it. thats all im really trying to do. i found a custom setup for "featured posts" and it works fine for just a thumbnail image. and im actually using that too for "coming events" and it works out perfect for that. but for the "latest media section" i need to have a title so people know if its pics, or vid.

    if i can get he excerpt part fixed it will be great and everything will work on the back end when i make a post by adding the custom field and a excerpt for the title, and of course assigned to the media category.

    thanks again for your help, please help me further if you can, or steer me in the right direction.

  • Topic Closed

    This topic has been closed to new replies.

    About this Topic

    Tags

    No tags yet.