Faisal Ahmed
Forum Replies Created
-
It still not fixed. I updated to latest version of the plugin. now it says
“Captcha not resolved” error message.Forum: Plugins
In reply to: [WooCommerce] Not apply functions.php changes to a specific elementHI you can easily do it by unhook that function. and then add action your custom function .You can use my code
remove_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10 ); add_action( 'woocommerce_shop_loop_item_title', 'my_template_loop_product_title', 10 ); function my_template_loop_product_title() { echo '<h2 class="h4"><a href="'.get_the_permalink().'">' . get_the_title() . '</a></h2>'; }
thank for the reply. I see your filter is adding extra menu item. but I need to replace default post menu and its content with my custom post type {recipe}.
thanks
Forum: Plugins
In reply to: [SMTP Mailing Queue] smtp credential are not saved permanentlyproblem is solved after update to 1.2.2
one quetion. How to I clear failure email list ?
Forum: Plugins
In reply to: [SMTP Mailing Queue] smtp credential are not saved permanentlyin the 1.2.0 it happened again I was last update password 9 hours ago. and now see the field is blank. now I have update plugin into to 1.2.2, and again save password field. let see after couple of hours, if it is still keep blank value
Forum: Plugins
In reply to: [SMTP Mailing Queue] smtp credential are not saved permanentlyok, I have updated the smq_version option in the options table to 1.1.1 from 1.2.0. After doing it, I am going to the SMTP setting page and again see blank value in the password field. I have again put a password to save the setting. but now I again see in the database it shows up smq_version is 1.2.0.
What Should I do now? I have all access DB, file manager all. I am a developer also. I can easily save the SMTP password as plain text in the DB. but I am waiting for your result so it will help me with the plugin future update.
thank you
Forum: Plugins
In reply to: [SMTP Mailing Queue] smtp credential are not saved permanentlyI can not remember that, I see the problem in the version 1.2.0
yes. only the password field has been reset and shows empty.I am basically login into my site after 2-5 days. and see this problem .. all emails are in the failure list. also, log in when a customer told me they didn’t get email.
I am using php 7.4.6
here is my plugin list
image linkForum: Plugins
In reply to: [SMTP Mailing Queue] smtp credential are not saved permanentlyyes. it has occurred multiple times. I was installed 1.1.0 at first then upgrade to 1.2.0. If you can be fixed this issue, then please let me know. otherwise I need to change plugin ??
Best Regards
Faisaloh sorry, I meant, I don’t want id with the slug. I want to load posts by category id.
category__and="69,37,29,45,19,36,28,44,18,35,27,43,16,33,25,41,17,34,26,42,117"
means load all posts from those categories. I don’t use slug anymore. but I need some functionality that does when putting slugs by commas.
thanks for your reply. I see it is not a or selection. IS there any way to get the same functionality as a slug ? because my slug may change at any time. but id will be fixed. I want to show all posts that from those cats.
Forum: Plugins
In reply to: [WP Post Rating] Howto sort posts by ratingThanks for the reply. I already fix it for my project. For sorting I am using below codes.
// the query
//$paged = get_query_var('page') ? get_query_var('page') : 1;
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
$sortby = get_query_var('sortby') ? get_query_var('sortby') : 'DESC';
if($sortby == "ASC"):
$orderby = "title";
else:
$orderby = "date";
endif;$gb_bundle_args = array (
'category_name' => $value, // pass category slug name
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => 6,
'paged' => $paged,
'meta_query' => array(
'relation' => 'AND',
'rating' => array(
'key' => '_kksr_casts',
'type' => 'NUMERIC',
'compare' => 'EXISTS',
),
'_kksr_avg' => array(
'key' => '_kksr_avg',
'compare' => 'EXISTS',
),
)
);
// Sort Results
$current_sort = isset( $_GET['sortby'] ) ? esc_attr( $_GET['sortby'] ) : 'DESC'; //default date sorting
switch( $current_sort ) {
case 'a2z': // title accending and date decending
$gb_bundle_args['orderby'] = array(
'title' => 'ASC',
'post_date' => 'DESC',
);
break;
case 'mrv': //most reviews
$gb_bundle_args['orderby'] = array(
'_kksr_casts' => 'DESC',
);
break;
case 'hrr': //highest rated
$gb_bundle_args['orderby'] = array(
'_kksr_avg' => 'DESC', // most avg
'_kksr_casts' => 'DESC', // most avg with highest review (can remove)
'post_date' => 'DESC', // date latest (can remove)
'title' => 'ASC', // title a-z (can remove)
);
break;
case 'lrr': // lowest rated
$gb_bundle_args['orderby'] = array(
'_kksr_avg' => 'ASC', // low avg
'_kksr_casts' => 'DESC', // low avg with highest review (can remove)
'post_date' => 'DESC', // date latest (can remove)
'title' => 'ASC', // title a-z (can remove)
);
break;
}
$gb_bundle_qry = new WP_Query($gb_bundle_args);
// echo ""; // var_dump($gb_bundle_qry->request); // echo "
";
$sortarr = array ('ASC','mrv','hrr','lrr');
Forum: Plugins
In reply to: [WP Post Rating] Howto sort posts by ratingthanks for the reply. I am fixed my abode code, it is now working for insert and delete a comment, but working avg and reviews count. not working for total star count. SO I have to commit total star count and do star count manually where I display the rating data. Here is my updated working code for avg and review count.
//new rating data save
// calculates average rating based on comment_meta 'rating'
function myPlugin_calculate_avg_rating($post_id = false){
if ( !function_exists('wpcr_avg_rating') ) {
return 0;
}
if ( !$post_id ) {
$post_id = get_the_ID();
}
$comments = get_approved_comments($post_id);
$sum = 0;
$avg = 0;
$count_rated = 0;
$oldavg = get_post_meta($post_id, '_kksr_avg',true);
$countold = get_post_meta($post_id, '_kksr_casts',true);
//$oldtotal = get_post_meta($post_id, '_kksr_ratings',true);
foreach ( $comments as $comment ) {
$rating = get_comment_meta($comment->comment_ID, 'rating', true);
if ( $rating ) {
$sum = $sum + (int)$rating;
$count_rated++;
}
}
if ($countold && $oldavg ){
$count_rated = $count_rated;
$sum = $sum;
$avg =round(($sum/$count_rated),2);
}
if ( $count_rated > 0 ) {
$count_rated = $count_rated;
$sum = $sum;
$avg = round(($sum/$count_rated),2);
}
return array($avg,$count_rated);
}
// add own rating avg function for better displaying
function myPlugin_avg_rating($atts) {
if ( !function_exists('wpcr_avg_rating') ) {
return '';
}
$a = shortcode_atts(array('title' => 'Rating',), $atts); // what is this good for?
$output = '';
$post_id = get_the_ID();
$avg = myPlugin_calculate_avg_rating($post_id); // now stored to post
$comment_count = wp_count_comments($post_id)->approved;
$wpcr_options = get_option('wpcr_settings');
$tooltip_inline = $wpcr_options['tooltip_inline'];
$avgrating_text = $wpcr_options['wpcravg_text'];
$avg_text = $avgrating_text == '' ? __( 'Average', 'wp-post-comment-rating' ) : $avgrating_text;
$avgText = __('average', 'wp-post-comment-rating');
$outOf = __('out of 5. Total', 'wp-post-comment-rating');
if ( $avg > 0 ) {
if ( $tooltip_inline == 1 ) {
$output = '<div class="wpcr_aggregate t"><span class="wpcr_stars" title="">'.$avg_text.':</span>';
$output .= '<span class="wpcr_averageStars" id="'.$avg.'"></span></div>';
}
if ( $tooltip_inline == 0 ) {
$output = '<div class="wpcr_aggregate ta"><span class="wpcr_stars" title="">'.$avg_text.':</span>';
$output .= '<span class="wpcr_averageStars" id="'.$avg.'"></span><span class="avg-inline">('.$avgText.': '.round($avg, 2).' '.$outOf.': '.$comment_count.')</span></div>';
}
}
return $output;
}
// add avg rating to post meta after a comment was written
// sets post_meta '_wpcr_rating' when new approved comment is posted
function myPlugin_comment_post($id, $approved){
if ($approved == 1){
myPlugin_post_meta_avg_rating(get_comment($id)->comment_post_ID);
//update_rrating_count(get_comment($id)->comment_post_ID);
//update_rrating_total(get_comment($id)->comment_post_ID);
}
}
add_action('comment_post', 'myPlugin_comment_post', 10, 2);
// sets post_meta '_wpcr_rating' when wp_set_comment_status is called
function myPlugin_wp_set_comment_status($id, $status){
//if($status =='approve'){
myPlugin_post_meta_avg_rating(get_comment($id)->comment_post_ID);
//update_rrating_count(get_comment($id)->comment_post_ID);
//update_rrating_total(get_comment($id)->comment_post_ID);
//}
}
add_action('wp_set_comment_status', 'myPlugin_wp_set_comment_status', 10, 2);
// sets post_meta '_wpcr_rating' when approved or deleted
function myPlugin_transition_comment_status($new_status, $old_status, $comment){
//if($new_status != $old_status){
myPlugin_post_meta_avg_rating($comment->comment_post_ID);
//update_rrating_count($comment->comment_post_ID);
//update_rrating_total($comment->comment_post_ID);
//}
}
add_action('transition_comment_status', 'myPlugin_transition_comment_status', 10, 3);
// sets post_meta '_wpcr_rating'
function myPlugin_post_meta_avg_rating($post_id){
$avg = myPlugin_calculate_avg_rating($post_id);
//if ( $action == 'insert') {
update_post_meta($post_id, '_kksr_avg', $avg[0]);
//update_post_meta($post_id, '_kksr_ratings', $avg[2]);
update_post_meta($post_id, '_kksr_casts', $avg[1]);
// }
}
// function update_rrating_count ($post_id) {
// $rcount = myPlugin_calculate_avg_rating($post_id);
// update_post_meta($post_id, '_kksr_casts', $rcount[1]);
// }
// function update_rrating_total ($post_id) {
// $rtt = myPlugin_calculate_avg_rating($post_id);
// update_post_meta($post_id, '_kksr_ratings', $rtt[2]);
// }
Forum: Plugins
In reply to: [WP Post Rating] Howto sort posts by ratingUpdate :
I am now using your function to set post meta , like avg, total and rating count
when a new comment is posted post meta value is updated but. when I delete the comment it is again updated post meta but the value increases not downgrade. can you please tell me where is my problem? Below is my modified code. I have put all into function PHP. I display post meta value in single.php for show result.
//new rating data save
// calculates average rating based on comment_meta 'rating'
function myPlugin_calculate_avg_rating($post_id = false){
if ( !function_exists('wpcr_avg_rating') ) {
return 0;
}
if ( !$post_id ) {
$post_id = get_the_ID();
}
$comments = get_approved_comments($post_id);
$sum = 0;
$avg = 0;
$count_rated = 0;
$oldavg = get_post_meta($post_id, '_kksr_avg',true);
$countold = get_post_meta($post_id, '_kksr_casts',true);
$oldtotal = get_post_meta($post_id, '_kksr_ratings',true);
foreach ( $comments as $comment ) {
$rating = get_comment_meta($comment->comment_ID, 'rating', true);
//var_dump($checkc);
if ( $rating ) {
$sum = $oldtotal + (int)$rating;
$count_rated++;
}}
if ($countold && $oldavg && $oldtotal ){
$count_rated = $count_rated;
$sum = $sum;
$avg =round(($sum/$count_rated),2);
}
if ( $count_rated > 0 || $oldtotal ) {
$count_rated = $count_rated;
$sum = $sum;
$avg = $sum/$count_rated;}
return array($avg,$count_rated,$sum);
}// add own rating avg function for better displaying
function myPlugin_avg_rating($atts) {
if ( !function_exists('wpcr_avg_rating') ) {
return '';
}
$a = shortcode_atts(array('title' => 'Rating',), $atts); // what is this good for?
$output = '';$post_id = get_the_ID();
$avg = myPlugin_calculate_avg_rating($post_id); // now stored to post
$comment_count = wp_count_comments($post_id)->approved;$wpcr_options = get_option('wpcr_settings');
$tooltip_inline = $wpcr_options['tooltip_inline'];
$avgrating_text = $wpcr_options['wpcravg_text'];
$avg_text = $avgrating_text == '' ? __( 'Average', 'wp-post-comment-rating' ) : $avgrating_text;
$avgText = __('average', 'wp-post-comment-rating');
$outOf = __('out of 5. Total', 'wp-post-comment-rating');if ( $avg > 0 ) {
if ( $tooltip_inline == 1 ) {
$output = '<div class="wpcr_aggregate t"><span class="wpcr_stars" title="">'.$avg_text.':</span>';
$output .= '<span class="wpcr_averageStars" id="'.$avg.'"></span></div>';
}
if ( $tooltip_inline == 0 ) {
$output = '<div class="wpcr_aggregate ta"><span class="wpcr_stars" title="">'.$avg_text.':</span>';
$output .= '<span class="wpcr_averageStars" id="'.$avg.'"></span><span class="avg-inline">('.$avgText.': '.round($avg, 2).' '.$outOf.': '.$comment_count.')</span></div>';
}
}
return $output;
}// add avg rating to post meta after a comment was written
// sets post_meta '_wpcr_rating' when new approved comment is posted
function myPlugin_comment_post($id, $approved){
myPlugin_post_meta_avg_rating(get_comment($id)->comment_post_ID);
update_rrating_count(get_comment($id)->comment_post_ID);
update_rrating_total(get_comment($id)->comment_post_ID);
}
add_action('comment_post', 'myPlugin_comment_post', 10, 2);// sets post_meta '_wpcr_rating' when wp_set_comment_status is called
function myPlugin_wp_set_comment_status($id, $status){
myPlugin_post_meta_avg_rating(get_comment($id)->comment_post_ID);
update_rrating_count(get_comment($id)->comment_post_ID);
update_rrating_total(get_comment($id)->comment_post_ID);
}
add_action('wp_set_comment_status', 'myPlugin_wp_set_comment_status', 10, 2);// sets post_meta '_wpcr_rating' when approved or deleted
function myPlugin_transition_comment_status($new_status, $old_status, $comment){myPlugin_post_meta_avg_rating($comment->comment_post_ID);
update_rrating_count($comment->comment_post_ID);
update_rrating_total($comment->comment_post_ID);
}
add_action('transition_comment_status', 'myPlugin_transition_comment_status', 10, 3);// sets post_meta '_wpcr_rating'
function myPlugin_post_meta_avg_rating($post_id){
$avg = myPlugin_calculate_avg_rating($post_id);
//if ( $action == 'insert') {
update_post_meta($post_id, '_kksr_avg', $avg[0]);
// }}
function update_rrating_count ($post_id) {
$rcount = myPlugin_calculate_avg_rating($post_id);
update_post_meta($post_id, '_kksr_casts', $rcount[1]);
}
function update_rrating_total ($post_id) {
$rtt = myPlugin_calculate_avg_rating($post_id);
update_post_meta($post_id, '_kksr_ratings', $rtt[2]);
}@netzgestaltung
- This reply was modified 5 years, 4 months ago by Faisal Ahmed.
Forum: Plugins
In reply to: [WP Post Rating] Howto sort posts by rating@netzgestaltung Hello, I see your code. It will help me for sorting. But I need 3 sort method, like below
1. sort by most rating(max total rating count)
2. sort by highest avg rating
3. sort by lowest avg rating.I am adding some query var for check condition. like if query var (mrr) then sort post by 1, then (har) for 2, then (lar) for 3.
can you please do something for it?
thanksForum: Plugins
In reply to: [Multi-Step Checkout for WooCommerce] Avada Theme order and payment not showYes. But my site is now coming soon mode . I will share a link . i want like same as it . order shoud be always visible and rest other will multistep . Please let me know If I need to change in your php code . I can do that. check this link below
https://www.sosorella.com/11737128/checkouts/17c2e13b1e196ab6e5f53ed5fac30a53