Replies
Hello the code did not work for me
The counter did not display in buddyblog at all
/* Display post views counter plugin in buddyblog post management */ add_filter( 'pvc_display_views_count', function( $display ) { if ( ! function_exists( 'buddyblog_pro' ) ) { return $display; } $pvc = Post_Views_Counter(); if ( empty( $pvc->options['display'] ) || empty( $pvc->options['display']['post_types_display'] ) ) { return $display; } $current_post_type = bblpro_get_current_post_type(); if ( ! $display && $current_post_type && in_array( $current_post_type, (array) $pvc->options['display']['post_types_display'] ) ) { $display = true; } return $display; } ); add_filter( 'the_excerpt', function ( $excerpt ) { if ( ! function_exists( 'Post_Views_Counter' ) ) { return $excerpt; } $alter = false; if ( function_exists( 'bp_is_buddyblog_component' ) && bp_is_buddyblog_component() ) { $alter = true; } elseif ( function_exists( 'bblpro_get_queried_post_id' ) && bblpro_get_queried_post_id() ) { $alter = true; } if ( ! $alter ) { return $excerpt; } return $excerpt . do_shortcode( '[post-views]' ); } );The code worked but caused another issue in my blog archive pages.
I have already added the post views shortcode into my content.php file but now your code adds another counter to the excerpt in my archive page.Your code should only display in buddyblog excerpt
see screenshot https://ibb.co/5vmtTbZ
Thanks Ravi
Now the excerpt is missing
add_filter( 'the_excerpt', function ( $excerpt ) { if ( ! function_exists( 'Post_Views_Counter' ) ) { return $excerpt; } echo do_shortcode( '[post-views]' ); } );Hello,
The issue came from > Display > Position= Manual. When I changed it to either After Content or Before Content the count displayed.
The problem now I want to use the Manual position because I added the post views code (<?php echo pvc_post_views(); ?>) directly into my theme’s content-single.php file.
Can you make the code to work for manual position
Thanks
Hello Ravi,
I added the code to functions.php file but it does not display the count like this https://ibb.co/f9KxjjR
The count does not display at all in users page.
Thanks
The plugin works fine in single post pages as seen here https://imgur.com/a/MMlNhhu
But displaying it in the post management section is the issue (A setting option to enable the display would be awesome when buddyblog detects the installation of the post views counter plugin)
Thanks for the feedback, the (advert) post type is registered by a 3rd party plugin
I have tested it and it works but I just want to be sure if the code is safe and will not cause any security issue.
- Tosin on March 18, 2022 at 12:48 pm in reply to: BuddyPress Friendship Restrictions support for follow #43897
Hello Brajesh,
Questions
1. Please what is the progress update on the relationship api and when will it be added to the core maybe bp 11.0 .
2. You mentioned that you were gonna release some plugins around monetization how is it coming along.Thanks