Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter chaimsem

    (@chaimsem)

    Thanks for you time!

    Thread Starter chaimsem

    (@chaimsem)

    thanks 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!

    Thread Starter chaimsem

    (@chaimsem)

    ok 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!

    • This reply was modified 3 years, 11 months ago by chaimsem.
    • This reply was modified 3 years, 11 months ago by chaimsem.
Viewing 3 replies - 1 through 3 (of 3 total)