Modelled on is_page_template, determine if we are in a single post template. You can optionally provide a template name and then the check will be specific to that template.
- $template (string) – The specific template name if specific matching is required.
bool $rue on success, false on failure.
Remove potentially duplicated hero images in posts
If the first paragraph of the post’s content contains an img tag with a src, and if the src is the same as the src as the post featured media image, or if the src are different but the attachment IDs are the same, then remove the first paragraph from the post’s content to hide the duplicate image.
This does catch img tags inside shortcodes.
This does not remove leading images that are different from the post featured media
permanent in the database. (@see https://github.com/INN/Largo/issues/354)
If you would like to disable this function globally or on certain posts, use the filter largo_remove_hero.
The $hanges to the content in this function should eventually be made
0.4 $ in Largo’s single-column template
0.5.5 $ in Largo’s two-column template
- $content (String) – the post content passed in by WordPress filter
String $iltered post content.
Retrieves the attachment ID from the file URL (or that of any thumbnail image)
Since: 0.4 See: https://pippinsplugins.com/retrieve-attachment-id-from-image-url/ Returns: Int $D of post attachment (or false if not found)
Given a post type and an optional context, return the partial that should be loaded for that sort of post.
The default context is search, and the context isn’t actually used by this function, but it is passed to the filter this function runs, largo_partial_by_post_type.
- $partial (string) – Required, the default partial in this context.
- $post_type (string) – Required, the given post’s post type
- $context (string) – Required, the context of this partial.
string $he partial that should be loaded. This defaults to ‘search’.