Get varying post count with timestamp of published date

  • prakashreddy.imduri
    Participant
    5 months ago #30749

    Hi, Is there any way to show the updated post count as we change the range slider, currently this value is static even after changing the published date slider, whereas other filters array count value is dynamic.
    This count is different from the total post count, its individual facet item count.
    Published date is a custom acf field here .
    Image image.png of Get varying post count with timestamp of published date
    Here the global facet is changing, depending on the filter options, but not the slider published date facet
    Image image.png of Get varying post count with timestamp of published date
    Image image.png of Get varying post count with timestamp of published date

    wpsolr
    Keymaster
    5 months ago #30750

    You mentioned the count on a range slider, but is is not displayed on the facet widget.
    Or do you meant the total results count?

    prakashreddy.imduri
    Participant
    5 months ago #30752

    Yes, its not displayed in the facet widget, but can we get that data in the array, so that we can use it for custom requirements.

    wpsolr
    Keymaster
    5 months ago #30753

    WPSOLR has no use of the slider facet count, but you can consider it is the total results count which you can gather in the page.

    wpsolr
    Keymaster
    5 months ago #30754

    If you want to inspect the data, you can use event WPSOLR_Events::WPSOLR_FILTER_UPDATE_FACETS_DATA:

    
    use wpsolr\core\classes\WPSOLR_Events;
    add_action( WPSOLR_Events::WPSOLR_FILTER_UPDATE_FACETS_DATA, 'my_facets_data', 10, 1 );
    /**
     * @param array $facets_data
     * @return array
     */
    function my_facets_data( $facets_data ) {
    /** Inspect $facets_data **/ 
    return $facets_data;
    }
    • This reply was modified 5 months ago by wpsolr.
    prakashreddy.imduri
    Participant
    5 months ago #30765

    Can we use search.php or facet.php in place of twig.php, as we want to add some custom php code to it. Currently search and other templates are getting rendered with twig templates.

    wpsolr
    Keymaster
    5 months ago #30766

    PHP templates are not used, and will be removed.
    Twig is the only way to render WPSOLR’s UI elements.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.