Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Link to the excerpt from front_page. WordPress

My site is set to show a static page as the front page.

I have then created a blank page called "Latest News" and have set this to display one post on the default template which I believe is index.php. I have modified index.php to show the_excerpt.

From the_excerpt on index.php there are the read more links that take the user to the_content on single.php

My question is this:

How can I link from my homepage to the excerpt of the post that is displayed on index.php, considering that the page id of the excerpt of the post is updated each time I add a new post.

At the moment when I click the link on the homepage it takes me to the full post display on single.php.

Here is the code for the link:

<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_post_thumbnail('300-thumb', array('class' => 'thumbnail')); ?></a>

Answers (5)

2012-02-07

Francisco Javier Carazo Gil answers:

Jules,

If I have understood well, you can use this function: http://codex.wordpress.org/Function_Reference/the_excerpt


Francisco Javier Carazo Gil comments:

Or something like this: http://wordpress.org/support/topic/custom-the_excerpt-with-read-more-link

2012-02-07

John Cotton answers:

Hi Jules

Your question isn't clear to me...

Where do you want to link to if not the permalink for the page?

Just a pop-up of the excerpt?

JC

2012-02-07

Luis Abarca answers:

For home page you should use home.php in your templates.

The info could be stored in post meta, you can store the post ID and then use get_post($post_id) to show the excerpt


Luis Abarca comments:

index.php is a fallback for your templates, if category.php, archive.php, single.php, etc, are missing, then WP will use index.php to show the info.

So, you dont need to use a static page, you can create a custom home.php and show the last post or a selected post.

But if you need the static page, you can store the last post ID in page custom meta to show the excerpt of the last post.


Luis Abarca comments:

<blockquote>But if you need the static page, you can store the last post ID in page custom meta to show the excerpt of the last post.</blockquote>

And you can use front-page.php to create the custom template.

2012-02-07

MDan answers:

Hello Jules,

Check this plugin:
http://www.dailyblogtips.com/homepage-excerpts-wordpress-plugin/

Daniel

2012-02-08

Arnav Joy answers:

can you explain some more points about your question , it is not clear..
Sorry!!!!