Resources

My Agape try

Your Agape try


Support Forum

You must be logged in to post Login Register

Search 
Search Forums:


 




Use of More Tag for teaser

UserPost

11:19 am
January 23, 2009


danf

Member

posts 24

1

Is it possible to set up the teaser to show everything above the <!–more–> tag?  If not by default, a hint on where to look to possibly add?  I am assuming it could be added as a drop down where the 'use excerpt' is and add similar code to that? 


Thanks for a great plugin!

1:40 pm
January 23, 2009


Kevin

Admin

posts 2502

2

Thanks for the great idea! I decided to go ahead and implement this as a Hidden Content Teaser option in the updated Role Scoper Development Snapshot. As you said, the only admin interface change is a new dropdown option - "pre-more content as teaser". If there is no more tag, the fixed teaser message is applied.

The "read the rest" message is still displayed in the posts listing, but upon clicking you discover that "the rest" in this case is simply the fixed teaser content replacement message as defined in Role Scoper Options.

If you are curious, the code changes (fairly minor) are all in query-interceptor_rs.php and admin/options.php

3:03 pm
January 23, 2009


danf

Member

posts 24

3

wow!  now that's service :)

now that I asked for that, I don't even know if I am going to use it.  I found a plugin called 'excerpt editor'

that will automatically generate an excerpt if there isn't one using either the more tag if available, or the first 70 chars of the content.  So, I can accomplish using the more tag when available, but also be able to have a custom excerpt on posts that I want to make different.

However, this plugin isnt working properly with the RS.  I have RS set to use the excerpt as teaser.  Does it call directly to the database to get excerpt when using it as teaser? or does it call the_excerpt(); ?  If its calling the excerpt(), this other plugin *should* be modifying it according to my configuration, but it doesnt appear to be in this scenario.  I will investigate deeper to see if Im missing a configuration, but if you have any ideas that would be great.

Thanks again.


3:36 pm
January 23, 2009


danf

Member

posts 24

4

in looking deeper, I don't see RS calling the_excerpt, so must be going through some back door to get it, unless Im missing something.


What would happen if after you retrieve the excerpt, you called: $excerpt = apply_filters('the_excerpt', $excerpt) before printing the excerpt?

This should work with the other plugin I found since I confirmed it is using add_filter( 'the_excerpt',..

to modify its changes, but don't know if that would break something else in RS.  Im sure there are other plugins using that filter that would benefit from that change as well.


Thanks again.


3:37 pm
January 23, 2009


Kevin

Admin

posts 2502

5

Well, that would require me to temporarily set the global $post variable, which I would rather not mess with. But try this hack and if it works with your other plugin I'll make it a define-activated option. In query-interceptor_rs.php:

change:

$object->$col_content = $object->$col_excerpt;

to:

global $post; $post = $object; $object->$col_content = the_excerpt();

Maybe a better solution would be for me to add an additional teaser mode "excerpt or pre-more", which would be applied in that order of preference. Anyone interested in writing some user-friendly documentation? :)

4:19 pm
January 23, 2009


danf

Member

posts 24

6

No luck.  Calling the_excerpt() actually prints to screen, so put all the text at the top.

Then I tried calling $object->$col_content = apply_filters('the_excerpt', $object->$col_excerpt);

but that didnt do anything either - returned blank.

So, if you did implement it, I would be willing to write some documentation. Basically the ideal order would be:

* Excerpt, if present

* More tag, if present

* Finally, first X characters of content, where X is configurable (other plugin uses drop down of 0, 35, 70, 100, 200)


11:04 pm
February 6, 2009


Kevin

Admin

posts 2502

7

Check out the new teaser options in RC9. I think it meets all your requests. The only hardship for you is that to customize the number of characters (default 50) for the "first X characters" fallback, you must add this line to wp-config.php:

define('SCOPER_TEASER_NUM_CHARS', 50); // (default is 50. set to any desired number of characters)

Posts which have no custom excerpt or more tag are not be exposed on the basis of a length less than SCOPER_TEASER_NUM_CHARS. Instead, they are covered with the fixed teaser message.


About the Agapetry forum

Currently Online:

13 Guests

Maximum Online: 150

Forums:

Groups: 2

Forums: 7

Topics: 1244

Posts: 5649

Members:

There are 1254 members

There are 1 guests


Kevin has made 2502 posts

Top Posters:

metal450 - 178

Ragnar - 108

YikYak - 70

whiteorb - 49

Daisy - 35

Administrator: Kevin | Moderators: Kevin