Skip to content

Instantly share code, notes, and snippets.

View espenmn's full-sized avatar

Espen Moe-Nilssen espenmn

View GitHub Profile
0) Also, install the file extensions wp
1) Install wp-maximum-upload-size
Edit twenty-twentysomething funcions.php
@ini_set( 'upload_max_size' , '264M' );
( sudo chown -R www-data wp-content/ )
export default function Edit( { attributes, setAttributes } ) {
const imSizes = useSelect(
( select ) => select( 'core/block-editor' ).getSettings().imageSizes
);
function replaceFunction(item) {
item.label = item.name;
item.value = item.slug;
<a href="<?php the_permalink(); ?>"><?php echo get_the_post_thumbnail(
$post->ID,
'mytheme-450',
array(
'srcset' => wp_get_attachment_image_url( get_post_thumbnail_id(), 'mytheme-450' ) . ' 480w, ' .
wp_get_attachment_image_url( get_post_thumbnail_id(), 'mytheme-300' ) . ' 640w, ' .
wp_get_attachment_image_url( get_post_thumbnail_id(), 'mytheme-450') . ' 1200w'
)
); ?>
</a>
/**
* Gutenberg Blocks
*
* All blocks related JavaScript files should be imported here.
* You can create a new block folder in this dir and include code
* for that block here as well.
*
* All blocks should be included here since this is the file that
* Webpack is compiling as the input file.
*/
// functions.php
function wporg_block_wrapper( $block_content, $block, ) {
$myAttr = $block['attrs'];
$myKeys = array_keys($myAttr);
$disabled = false;
foreach ($myKeys as $myKey) {
$myValue = $myAttr[$myKey];
if ($myKey == 'disableBlock' ){
<script>
jQuery(document).ready( function () {
jQuery('.datatable').DataTable({
'processing': true,
'data': [
['Tiger Nixon', '1' ],
['Garrett Winters', '2'],
],
columns: [
{ title: 'Name' },
@espenmn
espenmn / edit.js
Last active November 17, 2022 17:32
edit: ( props ) => {
const { attributes, setAttributes, isSelected } = props;
return (
<Fragment>
<InspectorControls>
<PanelBody
title="Settings for block"
>