bekar09
Forum Replies Created
-
My bad. Here is the link to the previous thread I am referring.
Hi Kamal,
Sorry for being so stupid. I fixed the problem. Pasting the snippet below so that it can be of help to others if required.
$avg = get_field('field_519ad9c6f5cf5'); $avg = number_format((float)($avg/2), 2, '.', ''); $votes_cast = get_field('field_519ada96f5cf6'); // $total_stars = is_numeric(get_option('kksr_stars')) ? get_option('kksr_stars') : 5; if(!get_post_meta($post_id, '_kksr_ratings', true)) { $ratings = $votes_cast * $avg; // $avg = $ratings ? number_format((float)$ratings, 2, '.', '') : 0; update_post_meta($post_id, '_kksr_ratings', round($ratings)); update_post_meta($post_id, '_kksr_casts', $votes_cast); update_post_meta($post_id, '_kksr_avg', $avg); }
Got it. Well I reverted back changes in your plugin file and decided to store values in the default plugin custom fields. I also modified my code as below:
$avg = get_field('field_519ad9c6f5cf5'); // Returns 6.3 $votes_cast = get_field('field_519ada96f5cf6'); // Returns 1900 $stars = ceil($avg); $total_stars = is_numeric(get_option('kksr_stars')) ? get_option('kksr_stars') : 5; if(!get_post_meta($post_id, '_kksr_ratings', true)) { $ratings = $stars / ($total_stars/5); $avg = $ratings ? number_format((float)$ratings, 2, '.', '') : 0; update_post_meta($post_id, '_kksr_ratings', $ratings); update_post_meta($post_id, '_kksr_casts', 1); // $votes_cast update_post_meta($post_id, '_kksr_avg', $avg); }
This works fine and outputs “6.00/10 (60.00%) 1 vote”, but if I replace
update_post_meta($post_id, '_kksr_casts', $votes_cast);
it does not work anymore.It shows “0.00/10 (0.03%) 1900 votes”, but the stars are not fuelled. What am I doing wrong?
Thanks.
Forum: Plugins
In reply to: [Advanced Custom Fields (ACF?)] Decimals not Working in Number FieldsI see that elliot has already committed the fix in github. picked the latest file number.php and it solved the problem.
Forum: Plugins
In reply to: [Advanced Custom Fields (ACF?)] Decimals not Working in Number FieldsDitto. I am facing the same problem on my site.
Forum: Fixing WordPress
In reply to: Recent Drafts on Dashboard to include Custom Post typesPerfect solution @amduffy.
Thanks for your help.
Forum: Fixing WordPress
In reply to: Get child post titles in list of parent post admin pageForget it. I figured out the problem. Pasting the correct snippet for people who want similar functionality.
case "persons": $persons = query_posts( array( 'post_type' => 'persons', 'meta_query' => array( array( 'key' => '_wpcf_belongs_books_id', 'value' => $post_id, 'compare' => '==', 'type' => 'numeric', ), ) ) ); if ( !empty( $persons ) ) { $out = array(); foreach ( $persons as $person ) { $out[] = sprintf( '<a href="%s">%s</a>', esc_url( add_query_arg( array( 'post' => $person->ID, 'action' => 'edit' ), 'post.php' ) ), esc_html( $person->post_title ) ); } /* Join the terms, separating them with a comma. */ echo join( __( ', ' ), $out ); } break; }
Forum: Fixing WordPress
In reply to: Get child post titles in list of parent post admin pagecan you give a small example of wp_list_pages being used to populate admin column?
I cannot directly use “child_of” directly because the posts are not direct children. There are two different post types; one being associated to the other based on a custom field.
Please read my requirement once again and let me know if its not clear.
Forum: Fixing WordPress
In reply to: Custom Avatar not showing upI am still breaking my head for this. any clue whats going on?
Forum: Fixing WordPress
In reply to: Custom Avatar not showing upDoes anyone face this issue with Genesis theme framework? I mean this used to work well with Thesis theme framework.
Forum: Fixing WordPress
In reply to: Custom Avatar not showing upI don’t want to use gravatar as the default avatar service. This code used to work for me but not anymore. Otto or somebody else have any clue as to whats happening?
Guys this is important. Please be advised that the authors of this plugin have injected two hidden links to their website by making the font-size and div height set to 0. This is highly unethical and it is probably the reason for being removed from the wordpress plugin directory. Please edit the plugin and use it.
I think a better way to get backlinks is to leave it upto the user to link or maybe release a premium version. Google penalizes for any hidden links in your website. I’ve released a version which is free from these hiddden links on my blog here https://www.incrediblogger.net/wordpress/plugins/easy-mashable-social-bar-plugin-recoded-cleaned/
Forum: Fixing WordPress
In reply to: Redirect loop after upgrading to WP 3.3Yes I think thats the only way to find out the offender. I’ll report back here once I found it out so that it can help others.
Forum: Fixing WordPress
In reply to: WordPress Editor adding junk characters.Ok. I think I figured out the problem. It was happening because of a plugin called EasyWpSeo which had admin side automatic text decoration.
Forum: Fixing WordPress
In reply to: WordPress Editor adding junk characters.I even tried deleting those junk from phpmyadmin, but it automatically adds it back again. This is amazing.