Page 1 of 2

Featured Content by Tags

Posted: 06 Feb 2010, 21:05
by metal450
Holy cow! I just tried out Suffusion for the first time and am absolutely blown away. Can't imagine ever using anything else again! Nor can I imagine how many hundreds of hours must've gone into developing it :)

One small feature I'd love to see would be the ability to select featured content by TAGS rather than categories (er, I guess I should say "in addition to" :P) My design has a fairly specific use for categories where each post is in exactly one; with tags, as many as necessary.

Re: Featured Content by Tags

Posted: 07 Feb 2010, 00:08
by metal450
Three more little things about the Featured Content section:

1) A handy option would be to enable the stripping of tags before showing post excerpts, i.e. on line 57 of featured-posts.php: $ret .= strip_tags(apply_filters('the_excerpt', $excerpt), "<p></p>");

Some of my posts have images embedded in them, which overlap with the featured image. This option would resolve that issue.

2) Randomize the order of featured content: add 'orderby'=>'rand' to the queries (again in featured-posts.php)

3) Ability to have the post index overlap the image, saving some vertical screen real estate. I did this with custom css, but it would probably be a nice option for those who don't know it:


Re: Featured Content by Tags

Posted: 07 Feb 2010, 00:41
by sayontan
Not sure what you mean for #1. How will stripping out the <p> tags help with images in your post? And in any case, unless you have explicitly included an image in your manual post excerpt you won't see two images. For automatic excerpts the featured posts function will automatically pull out images based on different factors - it will first look for a custom featured image field, if that is missing it will look for images in the media library and if that is missing, it will pull out the first embedded image in your post. So I don't see how you overlapping images.

Also #3 is is not going to be provided because it will pose significant difficulties if the text in the featured content is at the bottom of the slider. You can use the customization that you have provided.

I will look into #2 and the tags.

Re: Featured Content by Tags

Posted: 07 Feb 2010, 00:49
by metal450
The code posted for #1 will strip all tags EXCEPT <p></p> ;)

With regards to images, the image being shown in the featured box is being selected as you specify; the issue is with images that are within my post comment, which get taken as the excerpt and overlayed on the featured image (I don't have any explicit excerpts for my posts - "excerpts" are the automatic first 55 words as taken by WP, and as it happens, those first words often include images) - also note that they're not JUST "embedded img tags", they use a bit of tricky CSS (the technique I'm using is derived from this:

#3: Yeah, I caught that and ended up just setting the preview text to be only on the right. In any case, since this is achievable without hacking any PHP it's not a big issue, just thought it might be nice for some users to save those extra vertical pixels :)

#2 and tags: Coo. I have them both running as a temporary "hack" solution by just replacing the query on featured-posts.php line 92 with:

$cat_query = new WP_query(array('tag'=>'featured', 'orderby'=>'rand'));

(obviously it's a dirty hard-coded solution, but proof of concept that it works like a charm :))

Re: Featured Content by Tags

Posted: 07 Feb 2010, 02:35
by sayontan
Probably given the lateness of the hour I am not able to see the merit in stripping out the tags. Two main reasons for it:

1. In the auto-generated 55-word excerpt WP automatically strips out all the tags (it definitely cleans up images). So unless I am mistaken adding this filter will not give you anything extra. Moreover I couldn't really get a grip of your use case. The link you pointed me to talks about explicitly defining an <img> tag and then having a ton of CSS to achieve the zooming effect. The auto-generated excerpt will strip out that img tag by itself, so what are you gaining with the explicit filter? Do you have a URL for me to look at in your example?

2. I have had users who actually embed <img> tags in their manual excerpts and have decent enough hypertext in them. Applying the filter will clean up their manual excerpts as well.

Re: Featured Content by Tags

Posted: 07 Feb 2010, 12:26
by metal450
You're right - this is my mistake, I apologize. The images in the excerpts were actually not being stripped because of another plugin hooking into get_the_excerpt(); disabling all plugins caused the featured items to appear correctly.

Sorry about that!

Re: Featured Content by Tags

Posted: 10 Mar 2010, 10:45
by metal450
If the Featured Content by Tags is a lower priority, I wonder if it might be possible in the interim to toss a filter into suffusion_display_featured_posts() so I could tap into it and use tags that way? Sorry to be a bother, it's just the ONLY place I have to manually hack the source each time I upgrade to a new version :)

You've already got $sticky_query, $latest_query, $cat_query, $page_query; maybe something like $extra_query that's created by a filter; that way we can append other posts easily and you wouldn't have to bother making the admin menu necessary to select from tags...

Much appreciated!

Re: Featured Content by Tags

Posted: 07 Aug 2010, 21:39
by metal450
Hey Sayontan,

Any hope of getting this filter added at some point? I'm still re-hacking featured-posts.php every time there's a new version, so I can populate them by tags...

It should just be a matter of adding another two lines, something like this around, say, line 80:
$extra_query = apply_filters('suffusion_add_to_featured', 0);
if( $extra_query ) $extra_query = new WP_query($extra_query);

Plus two more lines to merge the results into the total a bit farther below.

Thanks again, much appreciated,

Re: Featured Content by Tags

Posted: 07 Aug 2010, 22:30
by sayontan
This should be in soon. It has managed to bubble up in my to-do list, along with some other things that need revamping in the featured content section.

Re: Featured Content by Tags

Posted: 07 Aug 2010, 22:31
by metal450
Awesome, looking forward to it! :)