• Resolved goldensw

    (@goldensw)


    Hi Hector,

    What options are available in the Elementor widget’s “HTML Markup settings” section? Does it offer the same level of HTML customization as the [wpp] shortcode?
    I’m especially interested in whether it supports custom content tags in post_html, the ajaxify parameter, and thumbnail_build options, same as the shortcode.

    Thanks!

    • This topic was modified 3 weeks, 6 days ago by goldensw.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Hector Cabrera

    (@hcabrera)

    Hey @goldensw,

    Behind the scenes, the Elementor widget actually uses the [wpp] shortcode to render the popular posts list 🙂 The widget just “translates” the configuration provided by the user into a format that the shortcode understands.

    There’s no user-facing option for thumbnail_build though, and its ajaxify parameter is controlled via Settings > WP Popular Posts > Tools > Data > Load popular posts list via AJAX.

    To change the thumbnail_build option you’ll want to hook into the (yet to be documented) wpp_elementor_widget_settings filter hook, like so for example:

    /**
    * Hooks into the WPP Elementor widget to change its settings on-the-fly.
    *
    * @param array $shortcode_settings WPP settings
    * @param string $elementor_widget_id Elementor widget ID
    * @return array $shortcode_settings
    */
    function customize_wpp_elementor_settings($shortcode_settings, $elementor_widget_id) {
    $shortcode_settings['thumbnail_build'] = 'manual';
    return $shortcode_settings;
    }
    add_filter( 'wpp_elementor_widget_settings', 'customize_wpp_elementor_settings', 10, 2 );

    You can also use this hook to programmatically enable/disable the ajaxify option as well, but note that it’ll only work on the front-end. The WP Popular Posts Elementor widget will always disable it on the editor screen.

    Thread Starter goldensw

    (@goldensw)

    Thanks for the detailed explanation about the filter! Very helpful!

    I plan to have AJAX disabled globally in WPP settings because most of my popular posts lists are on cached pages where freshness isn’t critical. But I’d like to have the option enable AJAX on specific Elementor widgets where I need up-to-date data (for example, a “most read” list below article content where the page cache TTL is long).

    Based on your example:

    function customize_wpp_elementor_settings($shortcode_settings, $elementor_widget_id) {
    if ( $elementor_widget_id === '57a079f' ) {
    $shortcode_settings['ajaxify'] = 1;
    }
    return $shortcode_settings;
    }
    add_filter( 'wpp_elementor_widget_settings', 'customize_wpp_elementor_settings', 10, 2 );

    Two questions: 1. Does this look correct? 2. Is the $elementor_widget_id the same ID shown in the editor (like 57a079f), or is it a different internal identifier?

    Plugin Author Hector Cabrera

    (@hcabrera)

    Yes, that looks correct. And yes, that’s the ID Elementor assigned to that particular widget instance. The $elementor_widget_id param is there for this exact use case 🙂 (if you duplicate the widget on Elementor’s edit screen you’ll see that the new instance has a different ID.)

    Thread Starter goldensw

    (@goldensw)

    Thank you Hector! Promise to donate, not only did you leave this plugin free you also support it. 🙂

Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.