Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Excerpts, Read more, Pagination (http://forum.bytesforall.com/forumdisplay.php?f=20)
-   -   [...] on excerpts - can they be made clickable links? (http://forum.bytesforall.com/showthread.php?t=269)

HalfWayThere Feb 7, 2009 04:44 PM

[...] on excerpts - can they be made clickable links?
 
Hi

Is it possible to arrange thing such that the "[...]" that shows at the end of all excerpts is a clickable link to the full post?

Also, can we change the "..." to different text here?

Thanks in advance.

Flynn Feb 8, 2009 01:33 PM

I think this plugin may be able to do that but I am not sure http://wordpress.org/extend/plugins/advanced-excerpt/

Or use the "More Tag" in your posts. I understand that you want it automated for all posts but I have idea for that right now

MacMyDay Feb 12, 2009 08:00 PM

Hey HalfWayThere & Flynn -

I tried the Advanced Exceprt, while it has nice features, it doesn't allow linking of the ellipsis. But did find this explanation and per the post has been tested on WP 2.7.x

http://lynnepope.net/the-excerpt-revisited

I imagine it will work with Altahualpa.

Flynn Feb 12, 2009 09:36 PM

Good find, I have not thought about filters or that there would be one for the excerpt. You can add that code to the bottom of atahualpa/functions.php. It's important to not introduce any blank space or lines before or after the code. Add it tightly to the bottom of functions.php. (Spaces and blank lines INSIDE the opening and closing PHP tags are o.k., just not outside). The functions.php must end with a closing ?> and not have a space or blank line after that.

MacMyDay Feb 12, 2009 11:49 PM

Excellent Flynn. That was the key. the ?>

Though this code allows you to link to the complete post from the excerpt, by eliminating or replacing the ellipsis the truncated text seems to hang... so I modified it a bit so that the ellipsis appears first then 'read more' eliminating the line break and making it seem more cohesive with the text of the excerpt. This is my implementation... this works for me and anyone else can modify this code...
Code:

//function to replace invalid ellipsis with text linking to the post 
function elpie_excerpt($text) 

  return str_replace('[...]', '<a href="'. get_permalink($post->ID) . '">' . ' [&hellip; Read More]' . '</a>', $text); 

add_filter('the_excerpt', 'elpie_excerpt');?>

I think this just gets pasted at the end of functions.php without any linebreaks or spaces. worked for me!

Shepherd Jim Mar 8, 2009 10:21 AM

My wife wants to accomplish the same thing as MacMyDay = make the automatically inserted ellipsis "[...]" be clickable -- linking to the full post on a single post page.

I'm comfortable editing the functions.php file but am concerned that this is a change I will have to go back in and re-do every time the theme is updated/re-installed ...that is the case, right?

Is the mod to functions.php still the best way to perform this magic?

BTW -- how is it determined how long the "automatic excerpt" is? Can/could that be modified.

I've tried to convince Pam that she should start using the "More" button, but she's gotten very used to having the excerpt process happen without input from her. :o

Flynn Mar 8, 2009 11:44 AM

Looks like there's a new plugin that can put a custom More link, set the excerpt length and specify which HTML tags to strip/leave http://wordpress.org/extend/plugins/custom-excerpts/

The other excerpt plugin http://wordpress.org/extend/plugins/advanced-excerpt/ doesn't seem to allow More links

For just setting a More link, without setting excerpt length, the code from MacMyDay above placed at the bottom of functions.php would work, too.

Shepherd Jim Mar 9, 2009 06:24 AM

Okay! I've installed that plugin "Custom Excerpts" and it does even more than we'd hoped:

1) we can choose the length in words of the excerpt created by the "automatic" excerpt process that WordPress performs without us inserting the <more> tag.

2) replace the standard ellipsis excerpt text "..." with "...Read More" or whatever else we'd like

3) the "...Read More" excerpt text can be set to "Dofollow" or "Nofollow" which makes it a hyperlink to the applicable single post page.

Question: The plugin's options page mentions "By making the excerpt link nofollow, pages where it's used will gain a small amount of PR."

What's "PR" and how much of a worry is this. I mean, making the excerpt text linkable was our whole goal in installing this plugin!


4) we are able to specify which, if any, html tags will be allowed to appear in excerpts. Note: I was not aware that WP woudl strip out any tags appearing the usual 55 word excerpts

Question: Why does WP strip out html in the excerpts and what's the danger of now going in and allowing some or all -- are some tags more dangerous than others


I'm just about reading to take our site "public" -- been building it in a subdirectory while our "old" html/frame-based site was "out" in the main directory with index.html online.

Flynn Mar 9, 2009 07:21 AM

4) There's nothing dangerous about HTML tags, you can leave them all in. It's more a visual issue. For instance, by removing all HTML formatting all excerpts will use about the same amount of space in the layout. If you leave HTML tags, then an excerpt with a <ul><li>..</li></ul> unordered or ordered list may take much more space than another excerpt that has only plain text. So the layout won't look so streamlined anymore. This can be important in layouts where 2 excerpts are listed side by side and the containers of those should have the same height.

3) The more link goes to the single post page which are quite important pages, they should get their share of PR. You'd usually want the single post pages to rank well in the search engines. Those (and the "Page" pages) are the actual content pages of a site, not the overview pages like "category", "archives" etc. So I would not use nofollow there. I'd use nofollow for RSS links, login links, links to social bookmark sites, etc, but not for links to single post pages.

But it would make sense to include the title of the post in the linked more tag.
Continue reading <a href="..">Title of post</a>
should be better than <a href"..">Continue Reading</a>

But that would require that the plugin allows to use a placeholder for the automatic more tag. It probably doesn't have that and I know no other plugin that does.

Shepherd Jim Mar 9, 2009 08:18 AM

Thanks Flynn! You really ARE everywhere and all-knowing! ;)

You're right, the "Custom Excerpts" plugin does not appear to have the ability to refer back to the post by its name. I might suggest to the author that they include that in the future.

Thanks again!

fromtheranks Jun 28, 2009 02:36 AM

Allow me to open up this thread.

I was playing with the elpie code below, to try to solve the inconsistent "Continue to click" issue, re: WP's [...], and at first I thought it worked everywhere, but it doesn't.

Here are the conditions (note: when I refer to "Only Excerpts" that is a setting in ATO --> "Posts or Excerpts"):

1. If "Only Excerpts" is not set and the <!--more--> tag is used on a post, the elpie code below works.

2. If "Only Excerpts" is set and the <!--more--> tag is not used, the elpie code below works.

3. If "Only Excerpts" is set and the <!--more--> tag is used, the elpie code below does not work. You get the excerpt but no tag.

4. If "Only Excerpts" is set but an excerpt has been "hard coded" in Post Edit, even if you have the <!--more--> tag the elpie code below does not work.

The moral of this story seems to be that you either use the elpie code below (or not) and consistently use the <!--more--> tag, or you consistently "hard code" an excerpt for each Post (which, as I understand it, is preferable from an SEO perspective).

Hope this helps.

P.S. And maybe some day Flynn will whip out his magic keyboard, when he has some time, and develop a consistent solution for all occurrences of an excerpt. :)


All times are GMT -6. The time now is 08:54 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.