llms_get_certificate_image( integer $id )
Retrieve an array of image data for a certificate background image
Description Description
If no image found, will default to the LifterLMS placeholder (which can be filtered for a custom placeholder)
Parameters Parameters
- $id
-
(integer) (Required) WP Certificate Post ID
Return Return
(array) associative array of certificate image details
Source Source
File: includes/functions/llms.functions.certificate.php
function llms_get_certificate_image( $id = 0 ) { $id = ( $id ) ? $id : get_the_ID(); $img_id = get_post_meta( $id, '_llms_certificate_image', true ); // don't retrieve a size if legacy mode is enabled $size = ( 'yes' === get_option( 'lifterlms_certificate_legacy_image_size', 'yes' ) ) ? '' : 'lifterlms_certificate_background'; $src = wp_get_attachment_image_src( $img_id, $size ); if ( ! $src ) { $height = apply_filters( 'lifterlms_certificate_background_image_placeholder_height', 616, $id ); $width = apply_filters( 'lifterlms_certificate_background_image_placeholder_width', 800, $id ); $src = apply_filters( 'lifterlms_certificate_background_image_placeholder_src', LLMS()->plugin_url() . '/assets/images/optional_certificate.png', $id ); } else { $height = apply_filters( 'lifterlms_certificate_background_image_height', $src[2], $id ); $width = apply_filters( 'lifterlms_certificate_background_image_width', $src[1], $id ); $src = apply_filters( 'lifterlms_certificate_background_image_src', $src[0], $id ); } return array( 'height' => $height, 'src' => $src, 'width' => $width, ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
2.2.0 | Introduced. |
User Contributed Notes User Contributed Notes
Permalink: