chaimsem
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: Sorting by most views/popular posts in WordPressThanks for you time!
Forum: Developing with WordPress
In reply to: Sorting by most views/popular posts in WordPressthanks so much!
I did try the advanced post queries and it didn’t have the function I am looking for.
The wordpress popular plugin does what I am looking for but it is not compatible with wordpress.com hosting.
It happens to be that the jetpack plugin is not my go to option in general but when it comes to top posts, they are doing a great job, also for related posts in my opinion.
The query ID gets generated by the elemnetor plugin which is the
elementor/query/my_custom_filter
my_custom_filter and the rest has to be built by me which is the query itself.What I am trying to do is to query the existing Jetpack top posts query into the elementor post sort “widget”.
Thanks!
Forum: Developing with WordPress
In reply to: Sorting by most views/popular posts in WordPressok so just to be clear,
put this:
if( function_exists( 'stats_get_csv' ) ) { $top_posts = stats_get_csv( 'postviews', 'period=month&limit=30' ); }
inside the post template, even though jetpack already exists and runs this action as a plugin?
another question is, I am unclear of what to put here:
// Posts or Portfolio Widget add_action( 'elementor/query/my_custom_filter', function( $query ) { ---- HERE----- // Modify the posts query here ----- HERE } );
based on the link, it sounds like something like this:
// Posts or Portfolio Widget add_action( 'elementor/query/my_custom_filter', function( $query ) { $query = array( [0] => array( ['post_id'] => 0 ['post_title'] => 'Home page' ['post_permalink'] => 'https://www.example.com/' ['views'] => 6806 ) [1] => array( ['post_id'] => 8005 ['post_title'] => 'Hello World!' ['post_permalink'] => ['views'] => 1845 ) /* till item [29] */ } );
not sure if this would be accurate?
Thanks a lot for the reply!