Banner Opengraph

Filter grid inline script

/grid/inline_script This filter is called once the inline JavaScript of all grids in a page is generated. It allows to change the inline script or to completely remove it if you want more control or initialize grids from your own script. Argument Type Description $script string Inline JavaScript of grids [pastacode lang=”php” manual=”function%20prefix_inline_script(%20%24script%20)%20%7B%0A%09%2F%2F%20We%20prevent%20initialization%20of%20grids%20in%20page.%0A%09return%20”%3B%0A%0A%7D%0A%0Aadd_filter(%20’wp_grid_builder%2Fgrid%2Finline_script’%2C%20’prefix_inline_script’%2C%2010%2C%201%20)%3B” message=”” highlight=””…

Banner Opengraph

JS Methods

JS Methods JS Methods are actions done by the plugin. Public methods allows to trigger an action programmatically and at any time. Methods can be set directly in your grid settings or in your own JS script. All Method examples presented in this documentation can be directly applied in your grid settings under customization tab…

Banner Opengraph

Filter facet html

/facet/html This filter is called before to display a facet on render or refresh. It allows to modifies the output of facets. Argument Type Description $html string Facet HTML markup $facet_id integer Facet id [pastacode lang=”php” manual=”function%20prefix_facet_html(%20%24html%2C%20%24facet_id%20)%20%7B%0A%0A%09%2F%2F%20If%20it%20matches%20facet%20id%201%2C%20we%20replace%20string%20in%20facet%20HTML.%20%0A%09if%20(%201%20%3D%3D%3D%20%24facet_id%20)%20%7B%20%24html%20%3D%20str_replace(%20’Facet%20string’%2C%20’Another%20string’%2C%20%24html%20)%3B%0A%0A%09%7D%0A%0A%09return%20%24html%3B%0A%0A%7D%0A%0Aadd_filter(%20’wp_grid_builder%2Ffacet%2Fhtml’%2C%20’prefix_facet_html’%2C%2010%2C%202%20)%3B” message=”” highlight=”” provider=”manual”/]

Banner Opengraph

Filter grid the object

/grid/the_object This filter is called when an object (post, term or user) has been setup in the loop after the WP_Query, WP_Term_Query or WP_User_Query It allows to modifies object properties like the title, excerpt, etc… Argument Type Description $object object Holds current object data in the loop (title, excerpt, etc…) [pastacode lang=”php” manual=”function%20prefix_object_data(%20%24object%20)%20%7B%0A%0A%09%2F%2F%20We%20get%20attachment%20object%20properties%20from%20a%20custom%20field.%20%0A%09%24attachment%20%3D%20get_post_meta(%20%24object-%3EID%2C%20’my_custom_attachment’%2C%20true%20)%3B%0A%09%09%0A%09%2F%2F%20We%20override%20post%20thumbnail%20(custom%20property%20of%20the%20plugin).%20%0A%09%24object-%3Epost_thumbnail%20%3D%20%5B%0A%09’alt’%20%3D%3E%20%24attachment-%3Ealt%2C%0A%09’title’%20%3D%3E%20%24attachment-%3Etitle%2C%0A%09’caption’%20%3D%3E%20%24attachment-%3Ecaption%2C%0A%09’description’%20%3D%3E%20%24attachment-%3Edescription%2C%20%0A%09’mime_type’%20%3D%3E%20’image’%2C%0A%09’sizes’%20%3D%3E%20%5B%20%0A%09%09’thumbnail’%20%3D%3E%20%5B%20%0A%09%09%09’url’%20%3D%3E%20%24attachment-%3Ethumbnail_url%2C%20%0A%09%09%09’width’%20%3D%3E%20%24attachment-%3Ethumbnail_width%2C%0A%09%09%09’height’%20%3D%3E%20%24attachment-%3Ethumbnail_height%2C%0A%09%09%09%5D%2C%0A%09%09’lightbox’%20%3D%3E%20%5B%0A%09%09%09’url’%20%3D%3E%20%24attachment-%3Elightbox_url%2C%0A%09%09%09%5D%2C%0A%09%09%5D%2C%0A%09%5D%3B%0A%09%0A%09return%20%24object%3B%0A%09%0A%7D%0A%0Aadd_filter(%20’wp_grid_builder%2Fgrid%2Fthe_object’%2C%20’prefix_object_data’%2C%2010%2C%201%20)” message=”” highlight=””…

Banner Opengraph

Filter grid loaders

/grid/loaders This filter allows to add custom loaders to display when a grid is filtered. Argument Type Description $loaders array Holds registered grid loaders [pastacode lang=”php” manual=”function%20prefix_register_grid_loaders(%20%24loaders%20)%20%7B%0A%0A%09%2F%2F%20’my_loader’%20corresponds%20to%20the%20loader%20slug.%20%0A%09%24loaders%5B’my_loader’%5D%20%3D%20%5B%20%0A%09%09’name’%20%3D%3E%20__(%20’Loading…’%2C%20’text-domain’%20)%2C%0A%09%09’html’%20%3D%3E%20’%3Cdiv%20class%3D%22loading-text%22%3E’%20.%20esc_html__(%20’Loading…’%2C%20’text-domain’%20)%20.%20’%3C%2Fdiv%3E’%2C%20%0A%09%09’css’%20%3D%3E%20’%40keyframes%20loading-animation%7B0%25%7Bopacity%3A1%7D50%25%7Bopacity%3A0%7D100%25%7Bopacity%3A1%7D%7D.my_loader%7Bdisplay%3Aflex%3Balign-items%3Acenter%3Bjustify-content%3Acenter%7D.loading-text%7Bfont-weight%3A600%3Bfont-size%3A14px%3Bbackground%3A0%200!important%3Banimation%3Aloading-animation%201s%20infinite%7D’%2C%20%0A%09%5D%3B%0A%09%0A%09return%20%24loaders%3B%0A%0A%7D%0A%0Aadd_filter(%20’wp_grid_builder%2Fgrid%2Floaders’%2C%20’prefix_register_grid_loaders’%2C%2010%2C%201%20)%3B” message=”” highlight=”” provider=”manual”/]

Banner Opengraph

Filter facet query string

/facet/query_string This filter is called before the content is queried from WP_Query, WP_Term_Query or WP_User_Query It allows to filter content by adding facet slug/values in the query string. This filter is pretty useful to prefilter content on load. Argument Type Description $query_string array Holds query strings parameters $grid_id mixed Grid ID or template ID/name $action…

Banner Opengraph

Filter blocks

/blocks This filter is called when the card builder retrieves available blocks and when a card renders custom blocks. It allows to add your own blocks in the card builder in order to output custom content with your own markup and logic. Argument Type Description $blocks array Holds custom block definitions [pastacode lang=”php” manual=”function%20prefix_register_block(%20%24blocks%20)%20%7B%0A%0A%09%2F%2F%20’my_block’%20corresponds%20to%20the%20block%20slug.%0A%09%24blocks%5B’my_block’%5D%20%3D%20%5B%0A%09%09’name’%20%3D%3E%20__(%20’My%20Block’%2C%20’text-domain’%20)%2C%0A%09%09’render_callback’%20%3D%3E%20’prefix_my_block_render’%2C%0A%09%5D%3B%0A%0A%09return%20%24blocks%3B%0A%0A%7D%0A%0Aadd_filter(%20’wp_grid_builder%2Fblocks’%2C%20’prefix_register_block’%2C%2010%2C%201%20)%3B%0A%0A%2F%2F%20The%20render%20callback%20function%20allows%20to%20output%20content%20in%20cards.%0Afunction%20prefix_my_block_render()%20%7B%0A%0A%09%2F%2F%20Get%20current%20post%2C%20term%2C%20or%20user%20object.%0A%09%24post%20%3D%20wpgb_get_post()%3B%0A%0A%0A%09%2F%2F%20Output%20the%20post%20title.%20%0A%09echo%20’%3Ch3%3E’%20.%20esc_html(%20%24post-%3Epost_title%20)%20.%20’%3C%2Fh3%3E’%3B%0A%7D” message=””…