Multiple Voting Bars in one post
-
Hello!
I have the problem that I have this THUMBS UP/THUMBS DOWN bar 3 times in my post!
1 in the end of the post (as it should be)
and 2 in 2 different “expandable” jquery spoilers…Is there a way to limit it, so only the bottom one (end of thread) shhows?
Any help would be nice! π
Edit:/ The expandable spoilers code:
[dropdown_box expand_text=”spoiler title” start=”hide”]Text in spoiler[/dropdown_box]
-
I guess you don’t have to install the buttons within your functions.php
Instead, you should place the code on the template (single.php or whatever it is you want it to show up). Use this snippet:
<?=function_exists('thumbs_rating_getlink') ? thumbs_rating_getlink() : ''?>Let me know if this helps.
Rick
It seems to be working, but the buttons on the FRONT PAGE dissapear…
Which is important :/ I need the Front Page buttons aswell…PS: Thanks for the insane fast support!!
Well, you have to put the code there too.
This is code I used in my functions.php
function thumbs_rating_print($content) { return $content.thumbs_rating_getlink(); } add_filter('the_content', 'thumbs_rating_print');I had the trouble with multiple vote buttons (see top post here)
Then I’ve added this line to my single.php
<?=function_exists('thumbs_rating_getlink') ? thumbs_rating_getlink() : ''?>
It showed all the multiple vote buttons + the one from the single.phpWhen I try to add your given (single.php) to my functions.php I’m getting a syntax error…
Here is the full code of my functions.php
<?php //////// Widgetized Sidebar. function zbench_widgets_init() { register_sidebar(array( 'name' => __('Primary Widget Area','zbench'), 'id' => 'primary-widget-area', 'description' => __('The primary widget area','zbench'), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="widgettitle">', 'after_title' => '</h3>' )); register_sidebar(array( 'name' => __('Singular Widget Area','zbench'), 'id' => 'singular-widget-area', 'description' => __('The singular widget area','zbench'), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="widgettitle">', 'after_title' => '</h3>' )); register_sidebar(array( 'name' => __('Not Singular Widget Area','zbench'), 'id' => 'not-singular-widget-area', 'description' => __('Not the singular widget area','zbench'), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="widgettitle">', 'after_title' => '</h3>' )); register_sidebar(array( 'name' => __('Footer Widget Area','zbench'), 'id' => 'footer-widget-area', 'description' => __('The footer widget area','zbench'), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="widgettitle">', 'after_title' => '</h3>' )); } add_action( 'widgets_init', 'zbench_widgets_init' ); //////// Custom Comments List. function zbench_mytheme_comment($comment, $args, $depth) { $GLOBALS['comment'] = $comment; switch ($pingtype=$comment->comment_type) { case 'pingback' : case 'trackback' : ?> <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>"> <div id="comment-<?php comment_ID(); ?>"> <div class="comment-author vcard pingback"> <cite class="fn zbench_pingback"><?php comment_author_link(); ?> - <?php echo $pingtype; ?> on <?php printf(__('%1$s at %2$s', 'zbench'), get_comment_date(), get_comment_time()); ?></cite> </div> </div> <?php break; default : ?> <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>"> <div id="comment-<?php comment_ID(); ?>"> <div class="comment-author vcard"> <?php echo get_avatar($comment,$size='40',$default='' ); ?> <cite class="fn"><?php comment_author_link(); ?></cite> <span class="comment-meta commentmetadata"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ); ?>"><?php printf(__('%1$s at %2$s', 'zbench'), get_comment_date(), get_comment_time()); ?></a><?php edit_comment_link(__('[Edit]','zbench'),' ',''); ?></span> </div> <div class="comment-text"> <?php comment_text(); ?> <?php if ($comment->comment_approved == '0') : ?> <p><em class="approved"><?php _e('Your comment is awaiting moderation.','zbench'); ?></em></p> <?php endif; ?> </div> <div class="reply"> <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))); ?> </div> </div> <?php break; } } //////// wp_list_comments()->pings callback function zbench_custom_pings($comment, $args, $depth) { $GLOBALS['comment'] = $comment; if('pingback' == get_comment_type()) $pingtype = 'Pingback'; else $pingtype = 'Trackback'; ?> <li id="comment-<?php echo $comment->comment_ID ?>"> <?php comment_author_link(); ?> - <?php echo $pingtype; ?> on <?php echo mysql2date('Y/m/d/ H:i', $comment->comment_date); ?> <?php } //////// Set the content width based on the theme's design and stylesheet. if ( ! isset( $content_width ) ) $content_width = 620; //////// WP nav menu register_nav_menus(array('primary' => 'Primary Navigation')); //////// Custom wp_list_pages function zbench_wp_list_pages(){ echo '<ul>' , wp_list_pages('title_li=') , '</ul>'; } //////// LOCALIZATION load_theme_textdomain('zbench', get_template_directory() . '/lang'); //////// custom excerpt function zbench_excerpt_length( $length ) { return 40; } add_filter( 'excerpt_length', 'zbench_excerpt_length' ); //Returns a "Read more Β»" link for excerpts function zbench_continue_reading_link() { return '<p class="read-more"><a href="'. esc_url(get_permalink()) . '">' . __( 'Read more Β»', 'zbench' ) . '</a></p>'; } //Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and zbench_continue_reading_link(). function zbench_auto_excerpt_more( $more ) { return ' β¦' . zbench_continue_reading_link(); } add_filter( 'excerpt_more', 'zbench_auto_excerpt_more' ); //Adds a pretty "Read more Β»" link to custom post excerpts. function zbench_custom_excerpt_more( $output ) { if ( has_excerpt() && ! is_attachment() ) { $output .= zbench_continue_reading_link(); } return $output; } add_filter( 'get_the_excerpt', 'zbench_custom_excerpt_more' ); //Custom more-links for zBench function zbench_custom_more_link($link) { return '<span class="zbench-more-link">'.$link.'</span>'; } add_filter('the_content_more_link', 'zbench_custom_more_link'); //////// Tell WordPress to run zbench_setup() when the 'after_setup_theme' hook is run. add_action( 'after_setup_theme', 'zbench_setup' ); if ( ! function_exists( 'zbench_setup' ) ): function zbench_setup() { // Add default posts and comments RSS feed links to head add_theme_support( 'automatic-feed-links' ); // This theme styles the visual editor with editor-style.css to match the theme style. add_editor_style(); // This theme allows users to set a custom background add_custom_background(); // Your changeable header business starts here define( 'HEADER_TEXTCOLOR', '' ); // No CSS, just IMG call. The %s is a placeholder for the theme template directory URI. define( 'HEADER_IMAGE', '' ); // default: none IMG // The height and width of your custom header. You can hook into the theme's own filters to change these values. // Add a filter to zbench_header_image_width and zbench_header_image_height to change these values. define( 'HEADER_IMAGE_WIDTH', apply_filters( 'zbench_header_image_width', 1280 ) ); define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'zbench_header_image_height', 200 ) ); // Don't support text inside the header image. define( 'NO_HEADER_TEXT', true ); // Add a way for the custom header to be styled in the admin panel that controls // custom headers. See zbench_admin_header_style(), below. add_custom_image_header( '', 'zbench_admin_header_style' ); if ( ! function_exists( 'zbench_admin_header_style' ) ) { //Styles the header image displayed on the Appearance > Header admin panel. function zbench_admin_header_style() { ?> <style type="text/css"> /* Shows the same border as on front end */ #headimg { } /* If NO_HEADER_TEXT is false, you would style the text with these selectors: #headimg #name { } #headimg #desc { } */ </style> <?php } } } // end of zbench_setup() endif; add_filter('widget_text', 'do_shortcode'); function mySearchFilter($query) { if ($query->is_search) { $query->set('post_type', 'post'); } return $query; } add_filter('pre_get_posts','mySearchFilter'); //////// Load up our theme options page and related code. require( dirname( __FILE__ ) . '/library/theme-options.php' ); //////// Load custom theme options $zbench_options = get_option('zBench_options'); add_theme_support( 'post-thumbnails' ); function thumbs_rating_print($content) { return $content.thumbs_rating_getlink(); } add_filter('the_content', 'thumbs_rating_print');1) Delete the plugin’s code from the functions.php
2) Paste the small snippet to each file you want the buttons to appear.
The problem is that there are over 2000 posts…
Isnt there a faster way πIf you paste the small snippet in the single.php it should show up in every post.
<?=function_exists('thumbs_rating_getlink') ? thumbs_rating_getlink() : ''?>Please notice I’m not saying paste it inside the post content. You have to paste it in the template file (the .php file)
Sorry, I’m a beginner…
As I said when I delete the code from the functions.php and add the snippet to the single.php (template file) everything is fine BUT the buttons dissapear from the FRONT PAGE (because the code in the functions.php was deleted)
I need them both, in front page and when people open the posts on bottom of the post…
Then you also need to add the short snippet to the index.php file which is the one that manages the home page. However every theme works different you will have to look at your files and try to figure out where to put it.
Good luck!
God bless you Ricard!!
Thanks for your endurance and support!!Everything works fine now!
Solution was to add the snippet to the single.php and into the index.php!I wish you a good day!!
Gonna write a small review! π
The topic ‘Multiple Voting Bars in one post’ is closed to new replies.