403Webshell
Server IP : 192.158.238.246  /  Your IP : 18.217.93.250
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/7779/task/7779/cwd/plugins/gutenkit-blocks-addon/src/blocks/post-tab/parts/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/7779/task/7779/cwd/plugins/gutenkit-blocks-addon/src/blocks/post-tab/parts/post.js
import { useEffect, useState } from '@wordpress/element';
import apiFetch from '@wordpress/api-fetch';

function Post({ post, attributes }) {
    const thumnailId = post.featured_media;
    const [thumbnailUrl, setThumbnailUrl] = useState('');
	const { truncateWords, placeholderImage } = window.gutenkit.helpers;

    useEffect(() => {
        if (thumnailId) {
            apiFetch({ path: `/wp/v2/media/${thumnailId}` })
                .then((media) => {
                    setThumbnailUrl(media?.source_url);
                })
                .catch((error) => {
                    console.error(error);
                });
        } else {
            setThumbnailUrl(placeholderImage);
        }
    }, [thumnailId]);

    return (
        <div className="tab__post__single--item">
            <div className="tab__post__single--inner">
                <a href='#' className="tab__post--header" aria-label="url">
                    <img src={thumbnailUrl} alt={post.title.rendered} className='gutenkit-post-tab-thumbnail-image' />
                </a>
                <h3 className="tab__post--title"><a href='#'>{attributes?.enableCropTitle ? truncateWords(post.title.rendered, attributes?.numberOfWordsTitle) : post.title.rendered}</a></h3>
            </div>
        </div>
    )
}

export default Post

Youez - 2016 - github.com/yon3zu
LinuXploit