Jump to content
Sign in to follow this  
kellid

How to adjust my homepage loop

Recommended Posts

kellid

Hello, With some help, I now have an excellent homepage loop showing the post from my 2 category pages. The problem is the excerpt it too long for the homepage and it's spilling into the footer. My question is can I change the code somehow to only shows the first few sentences or can I change the height of the the content pad only on this page and not have it changed on all pages? Here is the code in the functions.php add_action('pagelines_after_theloop','custom_loop'); function custom_loop(){ if ( is_front_page() ){ ?>

<?php $recent = new WP_Query(); ?> <?php $recent->query('cat=17&showposts=1'); ?> <?php while($recent->have_posts()) : $recent->the_post(); ?>

Forum

<?php the_post_thumbnail('thumbnail'); ?>

<?php the_title(); ?>

<?php the_excerpt(); ?> <?php endwhile; ?>
<?php $recent = new WP_Query(); ?> <?php $recent->query('cat=48&showposts=1'); ?> <?php while($recent->have_posts()) : $recent->the_post(); ?>

Daily Feed

<?php the_post_thumbnail('thumbnail'); ?>

<?php the_title(); ?>

<?php the_excerpt(); ?> <?php endwhile; ?>
<?php } } And the CSS.... #homepage_loop{ width:650px; position:absolute; } #homepage_loop div{ width:300px; } #homepage_loop div.one{ float:left; padding:0 20px 0 0; } #homepage_loop div.two{ float:right; padding: 0 0 0 20px; } Thanks!!! Kelli

Share this post


Link to post
Share on other sites
catrina
You can change the length of the excerpt by adding a filter to the functions.php file in PlatformBase. Please see here for the filter and change the word count: http://codex.wordpress.org/Function_Reference/the_excerpt#Control_Excerpt_Length_using_Filters

Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
Jenny
I wanted the excerpt of my full width posts to be smaller as well. I have the following added to functions.php in PlatformBase: [code]// Excerpt length filter function new_excerpt_length($length) { return 24; } add_filter('excerpt_length', 'new_excerpt_length');[/code] I don't know if that applies to your situation but hopefully it helps. :)

Jenny :: Web designer at Simple Mama (follow me at @simplemamacom)

Check out Share Me, a social sharing add-on for DMS that is super simple to set up.

Share this post


Link to post
Share on other sites
kellid
Thanks Simple Mama but the code didn't work for me. I'm still trying to figure out why.

Share this post


Link to post
Share on other sites
catrina
Did you add the other excerpt code I suggested or did you remove it before adding simple mama's?

Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
kellid
Hey Catrina, I did add it and I saw no change. I didn't make any edits, just added it as is... function new_excerpt_length($length) { return 20; } add_filter('excerpt_length', 'new_excerpt_length'); I removed it, I tried simple mama's and the same, then started getting a parse error. Do I have to link it to the custom loop somehow??

Share this post


Link to post
Share on other sites
Jenny
You should be adding the function to the functions.php file in PlatformBase at the very end of the file. [code]// Excerpt length filter function new_excerpt_length($length) { return 24; } add_filter('excerpt_length', 'new_excerpt_length');[/code] You don't have to do anything else in any other files.

Jenny :: Web designer at Simple Mama (follow me at @simplemamacom)

Check out Share Me, a social sharing add-on for DMS that is super simple to set up.

Share this post


Link to post
Share on other sites
kellid
did not work. Thanks so much for the help Simple Mama and Catrina!! I've enlisted the help of my developer friend. :)

Share this post


Link to post
Share on other sites
Rob
Hi, May I close this topic if resolved?

Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×