Wordpress Themes - WP Forum at BFA
Click here to register or to donate.
Auto self-registration is not available here - far too many spammers. This forum has many, many backlinks and because of that there is an intense desire among spammers to drop their links here.

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Plugins & Atahualpa »

Vote the Post Plugin


  #1  
Old Jun 18, 2009, 06:54 PM
janey73
 
15 posts · Jun 2009
I just posted this under my other userid, which wasn't connected to Paypal. So I created a new userid and was able to make a donation.

I'm using Theme Atahualpa 333 (really wonderful! Thank you.) and have installed the Vote the Post plugin.

It works beautifully on single post pages, showing the rating stars and a message.
http://innovation.marin.org/blog/c/?p=83

However, on the multiple posting pages, it loses the stars and the text, skips a line, and then places the question mark at the beginning of the post.

http://innovation.marin.org/blog/c/?cat=4

I tested it on a different theme and it worked fine, but I'd like to use it in Atahualpa 333. Any suggestions?

Many thanks.
  #2  
Old Jun 19, 2009, 03:50 AM
juggledad's Avatar
juggledad
 
23,671 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
You have 'Only Excerpts' set in the option ATO->Paost or Excerpts->Posts or excerpts on CATEGORY pages? - change this to 'Full Posts' and the start sill show up.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #3  
Old Jun 19, 2009, 12:15 PM
janey73
 
15 posts · Jun 2009
Thanks JuggleDad,

For overview reasons, we are needing the posts to be excerpts on the category pages. Then the user can drill down deeper if he/she wants to see more information.

I looked at the code being generated on the excerpt category pages, and it appears that Atahaulpa is putting <p> in various places just past the "Rating 3.00 out of 5" so that is cuts off the stars and puts the [?] on a new line. Any suggestions on how to get it to handle the same way on the excerpt category pages as on the full-post pages?

Much appreciated.

BTW, I just tried to donate to you in Firefox 3.0.11. there is no active button for:
" click this button >> donating to juggledad "
  #4  
Old Jun 20, 2009, 09:03 AM
juggledad's Avatar
juggledad
 
23,671 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
The problem here is that when you choose to display an excerpt, Atahualpa calls the WordPress routine to provide the extract. Eventually you get to the function wp_trim_excerpt.

This routing takes the post, and calls the PHP function strip_tags() which, as you can guess from it's name, strips all HTMLT, XML, and PHP tags from a string.

Now the 'stars' in the Vote-the-post plugin are actually a clever <span> and set of <div.'s that the CSS ends up substituting a gif of a star for. BUT as a reault of the strip_tags call, this <span> and the <div>'s are removed, so there is no code for the CSS to cause stars to show up.

The other theme I tried this on, did infact show the stars, but it was because when displaying the categories, it displayed the entire post, not the excerpt.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #5  
Old Jun 20, 2009, 08:54 PM
Flynn's Avatar
Flynn
 
3,768 posts · Oct 2008
Munich, Germany
Post updated 6-24-2009:

You can stop Wordpress from stripping certain tags from excerpts by adding this:

function bfa_wp_trim_excerpt($text) { // Fakes an excerpt if needed
if ( '' == $text ) {
$text = get_the_content('');
$text = apply_filters('the_content', $text);
$text = str_replace(']]>', ']]>', $text);
$text = strip_tags($text, '<p><span><div>');
$excerpt_length = 55;
$words = explode(' ', $text, $excerpt_length + 1);
if (count($words) > $excerpt_length) {
array_pop($words);
array_push($words, '<p>Continue reading <a href="'. get_permalink() . '">'. the_title('','',FALSE) . '</a></p>');
$text = implode(' ', $words);
}
}
return $text;
}
remove_filter('get_the_excerpt', 'wp_trim_excerpt');
add_filter('get_the_excerpt', 'bfa_wp_trim_excerpt');


at the bottom of Atahualpa's functions.php, before the last closing ?> tag.


Customize the code:
  • <p><span><div> = tags to be "excluded from being removed". The tags you include here will be left untouched. Only the opening tag is required, i.e. <span> to hold back Wordpress from removing <span class="bla"> and </span> inside excerpts
  • 55 = Excerpt length (word count)
  • <p>Continue reading <a href="'. get_permalink() . '">'. the_title('','',FALSE) . '</a></p> = Replaces the default [...] ellipsis at the end of excerpts. To keep using the default [...] replace the green text in the code with [...]

Last edited by Flynn; Jun 24, 2009 at 09:01 AM. Reason: Completely replaced wrong code
  #6  
Old Jun 22, 2009, 05:50 PM
janey73
 
15 posts · Jun 2009
Thanks for the explanation, JuggleDad. That helps!

And thanks for the code, Flynn. I put it in, but it didn't seem to make a difference. It still stripped it out. http://innovation.marin.org/blog/c/?cat=3

Here's the bottom part of the function.php code with the change put in.

// new comment template for WP 2.7+, legacy template for old WP 2.6 and older
if (!function_exists('paged_comments')) {
include_once (TEMPLATEPATH . '/functions/bfa_custom_comments.php');
function legacy_comments($file) {
if(!function_exists('wp_list_comments'))
$file = TEMPLATEPATH . '/legacy.comments.php';

return $file;
}
add_filter('comments_template', 'legacy_comments');
}
remove_filter('the_excerpt', 'wptexturize');
?>

If this is too big of a pain, don't worry about it. thanks so much for your help.
  #7  
Old Jun 23, 2009, 12:04 PM
janey73
 
15 posts · Jun 2009
JuggleDad, here is another bug you might want to check out. :-)

I was able to donate to you through Safari but not through Firefox (it didn't have a button or a live link). I am working with the latest versions of Safari, Firefox and OS X.
  #8  
Old Jun 24, 2009, 08:43 AM
Flynn's Avatar
Flynn
 
3,768 posts · Oct 2008
Munich, Germany
Quote:
Originally Posted by janey73
And thanks for the code, Flynn. I put it in, but it didn't seem to make a difference.
Sorry for that, I updated the post. Please try again.
  #9  
Old Jun 24, 2009, 04:28 PM
janey73
 
15 posts · Jun 2009
I love love love the "continued reading" portion that was added above. JUST what I was wanting. Thank you!

For some reason, the <span> tag is having <p> tags generated around it, so that the stars are on one line and the rest is on the next line, with the line spacing being funky.

Here is the page:

http://innovation.marin.org/?cat=5

<div class="rating-info">Rating 4.50 out of 5</div>
<p> <span class="rating4">
<div class="star1" rel="1"></div>
<div class="star2" rel="2"></div>
<div class="star3" rel="3"></div>
<div class="star4" rel="4"></div>
<div class="star5" rel="5"></div>
<p></span></p>
<div class="status-info">Thank you for voting!</div>
  #10  
Old Jun 25, 2009, 09:01 AM
juggledad's Avatar
juggledad
 
23,671 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
try changing the '$excerpt_length = 55;' to '$excerpt_length = 9999;'
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #11  
Old Jun 25, 2009, 09:47 AM
Flynn's Avatar
Flynn
 
3,768 posts · Oct 2008
Munich, Germany
For the missing link add <a> to the non-removable tags

$text = strip_tags($text, '<p><span><div><a>');

As for the <p>'s, not sure where they are coming from, are you adding some code for the Vote Post plugin into each posts. perhaps the <P> get created at that point

You could add this to the above code

$text = strip_tags($text, '<p><span><div>');
$text = str_ireplace("<p></span></p>", "</span>", $text);
$text = preg_replace("/
out of 5<\/div>\n<p>/i", "out of 5</div>", $text);
$excerpt_length =
55;



Or consider putting the whole Vote thing into the Byline at Theme Options -> Post/Page Info Items. Does the plugin provide a template tag, something like <?php vote_the_post(); ?> ? If so, you could put that into the Byline as you can use PHP there. Then you wouldn't have to deal with Excerpts at all. The Byline can be several lines, also with DIV's to create a horizontal line like the one you have now. Example:

various post info items here
<div style="border-top: 1px dotted #ccc; margin-top: 10px; padding-top: 10px">
<?php vote_the_post(); ?></div>

Last edited by Flynn; Jun 26, 2009 at 04:20 PM. Reason: Changed of 5</div> to of 5<\/div> (escaped slash)
  #12  
Old Jun 26, 2009, 08:08 AM
juggledad's Avatar
juggledad
 
23,671 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
The line
$text = preg_replace("/out of 5</div>\n<p>/i", "out of 5</div>", $text);
causes $text to come back null. If you comment it out, the $text coming out of this routine looks great, BUT...

something is adding the extra <p> after this routine finishes (I put an 'echo $text;' just before the return to see)

This extra <p> is messing with the Vote-the-Post's java script. I may have time to look deeper later, but I have to leave now.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #13  
Old Jun 26, 2009, 03:52 PM
janey73
 
15 posts · Jun 2009
Flynn and JuggleDad,

Thanks for your diligence in pursuing a way to make this work, and get rid of the pesky <p>'s.

As it turns out, this problem is bypassed with another creative solution you provided for me. I didn't really want the excerpt information in the category pages and you gave me a great solution.

http://forum.bytesforall.com/showthread.php?t=2171

And with that, the Vote the Post section is eliminated on the category pages, which is fine. I only want people to vote from the post page. So all is well.

Again, many thanks!!
  #14  
Old Jun 26, 2009, 04:21 PM
Flynn's Avatar
Flynn
 
3,768 posts · Oct 2008
Munich, Germany
Quote:
Originally Posted by juggledad
The line
$text = preg_replace("/out of 5</div>\n<p>/i", "out of 5</div>", $text);
causes $text to come back null.

Probably should have escaped the one slash inside the string, I updated the code above

$text = preg_replace("/out of 5<\/div>\n<p>/i", "out of 5</div>", $text);

Bookmarks

Tags
stars, vote, vote the post, voting

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Plugin : WP Print & WP Post Ratings do not work sns Plugins & Atahualpa 8 Feb 17, 2011 08:03 PM
[SOLVED] Next post and previous post links on top of single post page error susieswe Atahualpa 3 Wordpress theme 2 Jul 15, 2009 02:58 PM
WP-NicEdit Plugin ok with post but not ok with pages Ponics Plugins & Atahualpa 7 Jun 18, 2009 04:09 PM
Plugin Conflict w. Custom Post Background strangelove Plugins & Atahualpa 0 Mar 11, 2009 05:25 PM


All times are GMT -6. The time now is 06:05 PM.


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