Skip to content
This repository has been archived by the owner on Aug 23, 2024. It is now read-only.
/ WordPress-Image Public archive
forked from onvardgmbh/wp-image

WordPress Image helper class

Notifications You must be signed in to change notification settings

Shopnative/WordPress-Image

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

WordPress Image helper class

General Usage

<?php
use Onvardgmbh\WpImage;

$img = WpImage::find( $post_id );
?>
<img src="<?= $img->size( 'custom_size' ); ?>" alt="<?= $img->alt(); ?>">

API

WpImage::find( int|WP_POST|null $post )

Returns: New WpImage-object

Parameters:

  • $post: Post ID of an image

size( string $size = 'full' )

Returns: URL of the image, scaled and/or cropped to the specified size

Parameters:

  • $size: Image size name; One of the built-in "thumbnail", "small", "medium", "full", or custom size registered with add_image_size

alt()

Returns: Alt text for the image

caption()

Returns: Caption for the image

description()

Returns: Description for the image

permalink()

Returns: Permalink for the image

title()

Returns: Title text for the image

About

WordPress Image helper class

Topics

Resources

Stars

Watchers

Forks

Languages

  • PHP 100.0%