apply_filters( 'lp__price_html', $price, $sale_price, $args );

This code filters and customizes the HTML structure for price.


Plugin


Namespace

Launchpad


Parameters

float

$price

Regular price

float

$sale_price

Sale price

array

$args

Price HTML arguments


Return

string

Filtered price HTML arguments


Example

/**
 * Define a callback function to customize the HTML structure for price
 *
 * @param   string  $html       HTML representation of the price
 * @param   float   $price      Regular price
 * @param   float   $sale_price Sale price
 * @param   array   $args       Price HTML arguments
 * @return  string              Filtered HTML representation of the price
 */
function custom_price_html( $html, $price, $sale_price, $args ) {
    // Modify the $html as per your requirements
    $modified_html = '<span class="custom-price">' . $html . '</span>';
    // You can also modify $price, $sale_price, and $args here if needed

    return $modified_html;
}

// Add the filter hook for customizing the HTML structure for price
add_filter( 'lp__price_html', 'custom_price_html', 10, 4 );

In this example:

  • We’ve defined a callback function custom_price_html that takes the HTML representation of the price, regular price, sale price, and price HTML arguments as parameters.
  • Inside the callback function, we’ve modified the $html variable to wrap it in a <span> element with a custom class.
  • You can also modify $price, $sale_price, and $args within the callback function if needed.
  • We then use add_filter to hook our callback function to the “lp__price_html” filter. This associates our callback with the specific filter hook for customizing the HTML structure for price.

Related

Allow filter for specific admin pages.

Allow filter for specific admin pages arguments.

Allow filter for all admin sub views arguments.

Allow filter for admin views arguments of specific admin page and view.

Allow filter for admin sub views arguments of specific admin page, view, and sub view.

Allow filter for admin sub views arguments of specific admin page.

Allow filter for specific admin sub view arguments.

Allow filter for admin sub view arguments of specific admin view.

Allow filter for admin sub views param.

Allow filter for admin sub views param of specific admin page.

Allow filter for admin sub views param of specific admin page and view.

Allow filter for admin sub views param of specific admin page view.

Allow filter for all admin toolbar arguments.

Allow filter for specific admin toolbar arguments.

Allow filter for all admin toolbar arguments.

Allow filter for specific admin toolbar arguments.

Allow filter for all admin views arguments.

Allow filter for admin views arguments of specific admin page and view.

Allow filter for admin views arguments of specific admin page.

Allow filter for specific admin view arguments.

Allow filter for all admin views param.

Allow filter for admin views param of specific admin page.

Allow filtering the button HTML text to render.

Allow filter for customizing the HTML items for contact details.

Allow filter for all field group arguments.

Allow filter for specific field group arguments.

Allow field value filter.

Allow filtering the link HTML text to render.

Allow filtering of template parts to be rendered on a page.

Allow filtering of template parts to be rendered on a page for a specific template.

Allow filtering of template parts to be rendered on a page for a specific template and type.

Allow filter to customize the option of submit button HTML.

Allow filter for the price HTML arguments.

Allow filter for customizing the HTML items for social media links.