diff --git a/functions.php b/functions.php
index 15736e4..e34517c 100644
--- a/functions.php
+++ b/functions.php
@@ -692,3 +692,476 @@ function lcp_register_custom_image_sizes() {
// Hook into WordPress to register custom sizes
add_action('after_setup_theme', 'lcp_register_custom_image_sizes');
+
+
+/* CUSTOM POST TYPES */
+
+
+// Register the post meta field for the gallery
+function to_register_meta_fields() {
+ register_post_meta('post', 'lcp_post_gallery', [
+ 'type' => 'array',
+ 'description' => 'Custom post gallery',
+ 'single' => true,
+ 'show_in_rest' => true,
+ ]);
+}
+add_action('init', 'to_register_meta_fields');
+
+// Add meta box for the gallery
+function add_lcp_gallery_meta_box() {
+ add_meta_box(
+ 'lcp_gallery_meta_box',
+ __('Post Gallery', 'textdomain'),
+ 'render_lcp_gallery_meta_box',
+ 'post',
+ 'normal',
+ 'high'
+ );
+}
+add_action('add_meta_boxes', 'add_lcp_gallery_meta_box');
+
+// Render the meta box
+function render_lcp_gallery_meta_box($post) {
+ // Add nonce for security
+ wp_nonce_field('lcp_gallery_meta_box', 'lcp_gallery_meta_box_nonce');
+
+ // Get existing gallery items
+ $gallery_items = get_post_meta($post->ID, 'lcp_gallery', true);
+ if (!is_array($gallery_items)) {
+ $gallery_items = array();
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+ 'Gallery updated successfully'));
+ } else {
+ wp_send_json_error(array('message' => 'Failed to update gallery'));
+ }
+}
diff --git a/includes/blocks/lcp-dynamic-container/build/index.asset.php b/includes/blocks/lcp-dynamic-container/build/index.asset.php
index c9eef1f..85af080 100644
--- a/includes/blocks/lcp-dynamic-container/build/index.asset.php
+++ b/includes/blocks/lcp-dynamic-container/build/index.asset.php
@@ -1 +1 @@
- array('react', 'react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-i18n'), 'version' => '40a5279a7e8774abfe4c');
+ array('react', 'react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-i18n'), 'version' => '04e9c02e00cfeee61658');
diff --git a/includes/blocks/lcp-dynamic-container/build/index.js b/includes/blocks/lcp-dynamic-container/build/index.js
index b3ee1af..de44f34 100644
--- a/includes/blocks/lcp-dynamic-container/build/index.js
+++ b/includes/blocks/lcp-dynamic-container/build/index.js
@@ -1 +1 @@
-(()=>{"use strict";var e,l={717:()=>{const e=window.wp.blocks,l=window.wp.blockEditor,t=window.wp.components,n=window.React,o=window.wp.i18n,r=window.ReactJSXRuntime,a=JSON.parse('{"UU":"lcp/dynamic-container"}');(0,e.registerBlockType)(a.UU,{edit:function({attributes:e,setAttributes:a}){const i=(0,l.useBlockProps)(),{padding:s,maxWidthLarge:d,maxWidthMedium:x,maxWidthSmall:p,minHeightLarge:g,minHeightMedium:c,minHeightSmall:h,backgroundColor:u}=e,[m,f]=(0,n.useState)(!1),[C,j]=(0,n.useState)(!1),[v,b]=(0,n.useState)(u||"#ffffff"),_=(e,l,t)=>{const n={...s};n[e][l]=t,a({padding:n})},y=(e,l)=>{a({[`maxWidth${l}`]:e})},w=(e,l)=>{a({[`minHeight${l}`]:e})};return(0,n.useEffect)((()=>{console.log("Updated attributes:",e)}),[e]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(l.InspectorControls,{children:[(0,r.jsxs)(t.__experimentalToggleGroupControl,{label:"my label",value:"vertical",isBlock:!0,__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,children:[(0,r.jsx)(t.__experimentalToggleGroupControlOption,{value:"horizontal",label:"Horizontal"}),(0,r.jsx)(t.__experimentalToggleGroupControlOption,{value:"vertical",label:"Vertical"})]}),(0,r.jsxs)(t.BaseControl,{label:"Padding - Desktop",children:[(0,r.jsxs)("div",{style:{display:"flex",flexDirection:"row"},children:[(0,r.jsx)("span",{style:{marginRight:"10px"},children:"Padding"}),(0,r.jsx)(t.ToggleControl,{label:"Use Independent Padding",checked:m,onChange:()=>{f(!m)}})]}),m?(0,r.jsxs)("div",{style:{display:"grid",padding:"10px",gridTemplateColumns:"1fr 1fr",gap:"10px",justifyItems:"center"},children:[(0,r.jsxs)("fieldset",{style:{gridColumn:"span 2",width:"116px"},children:[(0,r.jsx)("legend",{children:"Top"}),(0,r.jsx)(t.__experimentalUnitControl,{value:s.extraLarge?.top||"10px",onChange:e=>_("extraLarge","top",e)})]}),(0,r.jsxs)("fieldset",{children:[(0,r.jsx)("legend",{children:"Left"}),(0,r.jsx)(t.__experimentalUnitControl,{value:s.extraLarge?.left||"10px",onChange:e=>_("extraLarge","left",e)})]}),(0,r.jsxs)("fieldset",{children:[(0,r.jsx)("legend",{children:"Right"}),(0,r.jsx)(t.__experimentalUnitControl,{value:s.extraLarge?.right||"10px",onChange:e=>_("extraLarge","right",e)})]}),(0,r.jsxs)("fieldset",{style:{gridColumn:"span 2",width:"116px"},children:[(0,r.jsx)("legend",{children:"Bottom"}),(0,r.jsx)(t.__experimentalUnitControl,{value:s.extraLarge?.bottom||"10px",onChange:e=>_("extraLarge","bottom",e)})]})]}):(0,r.jsx)(t.__experimentalUnitControl,{label:"Padding Value",value:999,onChange:e=>{a({padding:{extraLarge:{top:e,right:e,bottom:e,left:e},large:{top:e,right:e,bottom:e,left:e},medium:{top:e,right:e,bottom:e,left:e},small:{top:e,right:e,bottom:e,left:e}}})}})]}),(0,r.jsx)(t.BaseControl,{label:"Max Width",children:(0,r.jsxs)("div",{style:{display:"flex",flexDirection:"column"},children:[(0,r.jsx)(t.__experimentalUnitControl,{label:"Large",value:d,onChange:e=>y(e,"Large"),defaultUnit:"px"}),(0,r.jsx)(t.__experimentalUnitControl,{label:"Medium",value:x,onChange:e=>y(e,"Medium"),defaultUnit:"px"}),(0,r.jsx)(t.__experimentalUnitControl,{label:"Small",value:p,onChange:e=>y(e,"Small"),defaultUnit:"px"})]})}),(0,r.jsx)(t.BaseControl,{label:"Min Height",children:(0,r.jsxs)("div",{style:{display:"flex",flexDirection:"column"},children:[(0,r.jsx)(t.__experimentalUnitControl,{label:"Large",value:g,onChange:e=>w(e,"Large"),defaultUnit:"px"}),(0,r.jsx)(t.__experimentalUnitControl,{label:"Medium",value:c,onChange:e=>w(e,"Medium"),defaultUnit:"px"}),(0,r.jsx)(t.__experimentalUnitControl,{label:"Small",value:h,onChange:e=>w(e,"Small"),defaultUnit:"px"})]})}),(0,r.jsx)(t.BaseControl,{label:(0,o.__)("Background Color"),children:(0,r.jsxs)("div",{children:[(0,r.jsx)(t.Button,{onClick:()=>j(!C),children:(0,o.__)("Choose Background Color")}),C&&(0,r.jsx)(t.Popover,{position:"bottom center",children:(0,r.jsx)(t.ColorPalette,{value:v,onChange:e=>{b(e),a({backgroundColor:e})},colors:[{name:"Primary",slug:"primary",color:"#3E5062"},{name:"Secondary",slug:"secondary",color:"#2B3843"},{name:"Light Color - 1",slug:"light-color-1",color:"#ECF0F5"},{name:"Dark Gray",slug:"dark-gray",color:"#333333"},{name:"Accent",slug:"accent",color:"#61FFB6"}],disableCustomColors:!1})}),(0,r.jsx)("div",{style:{backgroundColor:v,width:"30px",height:"30px",marginTop:"10px",borderRadius:"50%"}})]})})]}),(0,r.jsx)("div",{...i,style:{maxWidth:d,minHeight:g},children:(0,r.jsx)(l.InnerBlocks,{})})]})},save:function(){const e=l.useBlockProps.save();return(0,r.jsx)("div",{...e,children:(0,r.jsx)(l.InnerBlocks.Content,{})})}})}},t={};function n(e){var o=t[e];if(void 0!==o)return o.exports;var r=t[e]={exports:{}};return l[e](r,r.exports,n),r.exports}n.m=l,e=[],n.O=(l,t,o,r)=>{if(!t){var a=1/0;for(x=0;x=r)&&Object.keys(n.O).every((e=>n.O[e](t[s])))?t.splice(s--,1):(i=!1,r0&&e[x-1][2]>r;x--)e[x]=e[x-1];e[x]=[t,o,r]},n.o=(e,l)=>Object.prototype.hasOwnProperty.call(e,l),(()=>{var e={57:0,350:0};n.O.j=l=>0===e[l];var l=(l,t)=>{var o,r,a=t[0],i=t[1],s=t[2],d=0;if(a.some((l=>0!==e[l]))){for(o in i)n.o(i,o)&&(n.m[o]=i[o]);if(s)var x=s(n)}for(l&&l(t);dn(717)));o=n.O(o)})();
\ No newline at end of file
+(()=>{"use strict";var e,l={717:()=>{const e=window.wp.blocks,l=window.wp.blockEditor,t=window.wp.components,n=window.React,o=window.wp.i18n,r=window.ReactJSXRuntime,a=JSON.parse('{"UU":"lcp/dynamic-container"}');(0,e.registerBlockType)(a.UU,{edit:function({attributes:e,setAttributes:a}){const i=(0,l.useBlockProps)(),{padding:s,maxWidthLarge:d,maxWidthMedium:x,maxWidthSmall:g,minHeightLarge:p,minHeightMedium:c,minHeightSmall:h,backgroundColor:u}=e,[m,f]=(0,n.useState)(!1),[C,j]=(0,n.useState)(!1),[v,b]=(0,n.useState)(u||"#ffffff"),_=(e,l,t)=>{const n={...s};n[e][l]=t,a({padding:n})},y=(e,l)=>{a({[`maxWidth${l}`]:e})},w=(e,l)=>{a({[`minHeight${l}`]:e})};return(0,n.useEffect)((()=>{console.log("Updated attributes:",e)}),[e]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(l.InspectorControls,{children:[(0,r.jsxs)(t.__experimentalToggleGroupControl,{label:"my label",value:"vertical",isBlock:!0,__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,children:[(0,r.jsx)(t.__experimentalToggleGroupControlOption,{value:"horizontal",label:"Horizontal"}),(0,r.jsx)(t.__experimentalToggleGroupControlOption,{value:"vertical",label:"Vertical"})]}),(0,r.jsxs)(t.BaseControl,{label:"Padding - Desktop",children:[(0,r.jsxs)("div",{style:{display:"flex",flexDirection:"row"},children:[(0,r.jsx)("span",{style:{marginRight:"10px"},children:"Padding"}),(0,r.jsx)(t.ToggleControl,{label:"Use Independent Padding",checked:m,onChange:()=>{f(!m)}})]}),m?(0,r.jsxs)("div",{style:{display:"grid",padding:"10px",gridTemplateColumns:"1fr 1fr",gap:"10px",justifyItems:"center"},children:[(0,r.jsxs)("fieldset",{style:{gridColumn:"span 2",width:"116px"},children:[(0,r.jsx)("legend",{children:"Top"}),(0,r.jsx)(t.__experimentalUnitControl,{value:s.extraLarge?.top||"10px",onChange:e=>_("extraLarge","top",e)})]}),(0,r.jsxs)("fieldset",{children:[(0,r.jsx)("legend",{children:"Left"}),(0,r.jsx)(t.__experimentalUnitControl,{value:s.extraLarge?.left||"10px",onChange:e=>_("extraLarge","left",e)})]}),(0,r.jsxs)("fieldset",{children:[(0,r.jsx)("legend",{children:"Right"}),(0,r.jsx)(t.__experimentalUnitControl,{value:s.extraLarge?.right||"10px",onChange:e=>_("extraLarge","right",e)})]}),(0,r.jsxs)("fieldset",{style:{gridColumn:"span 2",width:"116px"},children:[(0,r.jsx)("legend",{children:"Bottom"}),(0,r.jsx)(t.__experimentalUnitControl,{value:s.extraLarge?.bottom||"10px",onChange:e=>_("extraLarge","bottom",e)})]})]}):(0,r.jsx)(t.__experimentalUnitControl,{label:"Padding Value",value:999,onChange:e=>{a({padding:{extraLarge:{top:e,right:e,bottom:e,left:e},large:{top:e,right:e,bottom:e,left:e},medium:{top:e,right:e,bottom:e,left:e},small:{top:e,right:e,bottom:e,left:e}}})}})]}),(0,r.jsx)(t.BaseControl,{label:"Max Width",children:(0,r.jsxs)("div",{style:{display:"flex",flexDirection:"column"},children:[(0,r.jsx)(t.__experimentalUnitControl,{label:"Large",value:d,onChange:e=>y(e,"Large"),defaultUnit:"px"}),(0,r.jsx)(t.__experimentalUnitControl,{label:"Medium",value:x,onChange:e=>y(e,"Medium"),defaultUnit:"px"}),(0,r.jsx)(t.__experimentalUnitControl,{label:"Small",value:g,onChange:e=>y(e,"Small"),defaultUnit:"px"})]})}),(0,r.jsx)(t.BaseControl,{label:"Min Height",children:(0,r.jsxs)("div",{style:{display:"flex",flexDirection:"column"},children:[(0,r.jsx)(t.__experimentalUnitControl,{label:"Large",value:p,onChange:e=>w(e,"Large"),defaultUnit:"px"}),(0,r.jsx)(t.__experimentalUnitControl,{label:"Medium",value:c,onChange:e=>w(e,"Medium"),defaultUnit:"px"}),(0,r.jsx)(t.__experimentalUnitControl,{label:"Small",value:h,onChange:e=>w(e,"Small"),defaultUnit:"px"})]})}),(0,r.jsx)(t.BaseControl,{label:(0,o.__)("Background Color"),children:(0,r.jsxs)("div",{children:[(0,r.jsx)(t.Button,{onClick:()=>j(!C),children:(0,o.__)("Choose Background Color")}),C&&(0,r.jsx)(t.Popover,{position:"bottom center",children:(0,r.jsx)(t.ColorPalette,{value:v,onChange:e=>{b(e),a({backgroundColor:e})},colors:[{name:"Primary",slug:"primary",color:"#3E5062"},{name:"Secondary",slug:"secondary",color:"#2B3843"},{name:"Light Color - 1",slug:"light-color-1",color:"#ECF0F5"},{name:"Dark Gray",slug:"dark-gray",color:"#333333"},{name:"Accent",slug:"accent",color:"#61FFB6"}],disableCustomColors:!1})}),(0,r.jsx)("div",{style:{backgroundColor:v,width:"30px",height:"30px",marginTop:"10px",borderRadius:"50%"}})]})})]}),(0,r.jsx)("div",{...i,style:{maxWidth:d,minHeight:p},children:(0,r.jsx)(l.InnerBlocks,{})})]})},save:function(){return(0,r.jsx)(l.InnerBlocks.Content,{})}})}},t={};function n(e){var o=t[e];if(void 0!==o)return o.exports;var r=t[e]={exports:{}};return l[e](r,r.exports,n),r.exports}n.m=l,e=[],n.O=(l,t,o,r)=>{if(!t){var a=1/0;for(x=0;x=r)&&Object.keys(n.O).every((e=>n.O[e](t[s])))?t.splice(s--,1):(i=!1,r0&&e[x-1][2]>r;x--)e[x]=e[x-1];e[x]=[t,o,r]},n.o=(e,l)=>Object.prototype.hasOwnProperty.call(e,l),(()=>{var e={57:0,350:0};n.O.j=l=>0===e[l];var l=(l,t)=>{var o,r,a=t[0],i=t[1],s=t[2],d=0;if(a.some((l=>0!==e[l]))){for(o in i)n.o(i,o)&&(n.m[o]=i[o]);if(s)var x=s(n)}for(l&&l(t);dn(717)));o=n.O(o)})();
\ No newline at end of file
diff --git a/includes/blocks/lcp-dynamic-container/build/style-index-rtl.css b/includes/blocks/lcp-dynamic-container/build/style-index-rtl.css
index 47253dd..4c40234 100644
--- a/includes/blocks/lcp-dynamic-container/build/style-index-rtl.css
+++ b/includes/blocks/lcp-dynamic-container/build/style-index-rtl.css
@@ -1 +1 @@
-.wp-block-create-block-lcp-viewport{background-color:#21759b;color:#fff;padding:2px}
+.wp-block-create-block-lcp-viewport{background-color:#21759b;color:#fff;padding:2px}.lcp-dynamic-container.lcp-has-background-image{position:relative;width:100%}.lcp-dynamic-container.lcp-has-background-image>.lcp-background-image{height:100%;right:0;-o-object-fit:cover;object-fit:cover;-o-object-position:center center;object-position:center center;position:absolute;top:0;width:100%}
diff --git a/includes/blocks/lcp-dynamic-container/build/style-index.css b/includes/blocks/lcp-dynamic-container/build/style-index.css
index 47253dd..b00889b 100644
--- a/includes/blocks/lcp-dynamic-container/build/style-index.css
+++ b/includes/blocks/lcp-dynamic-container/build/style-index.css
@@ -1 +1 @@
-.wp-block-create-block-lcp-viewport{background-color:#21759b;color:#fff;padding:2px}
+.wp-block-create-block-lcp-viewport{background-color:#21759b;color:#fff;padding:2px}.lcp-dynamic-container.lcp-has-background-image{position:relative;width:100%}.lcp-dynamic-container.lcp-has-background-image>.lcp-background-image{height:100%;left:0;-o-object-fit:cover;object-fit:cover;-o-object-position:center center;object-position:center center;position:absolute;top:0;width:100%}
diff --git a/includes/blocks/lcp-dynamic-container/lcp-dynamic-container.php b/includes/blocks/lcp-dynamic-container/lcp-dynamic-container.php
index 84fc3eb..6d1471b 100644
--- a/includes/blocks/lcp-dynamic-container/lcp-dynamic-container.php
+++ b/includes/blocks/lcp-dynamic-container/lcp-dynamic-container.php
@@ -65,10 +65,10 @@ if (!function_exists('lcp_random_string')) {
}
- function render_lcp_container( $attributes, $content ) {
+ function render_lcp_dynamic_container( $attributes, $content ) {
// Debugging: Check the passed attributes
//var_dump($attributes);
-
+
// Generate a random class name (optional, could be customized)
$random_class = lcp_random_string(12,true);
@@ -159,13 +159,39 @@ if (!function_exists('lcp_random_string')) {
if ( ! empty( $style ) ) {
$style_tag = sprintf( '', esc_attr( $random_class ), $style );
}
+ // Set the post thumbnail
+ if ( has_post_thumbnail() ) {
+ // Get the post thumbnail URL for different sizes
+ $full_size_url = get_the_post_thumbnail_url( get_the_ID(), 'full' );
+ $medium_size_url = get_the_post_thumbnail_url( get_the_ID(), 'medium' );
+ $large_size_url = get_the_post_thumbnail_url( get_the_ID(), 'large' );
+
+ // Generate the element with and
tags for responsiveness
+ $post_thumb = '';
+
+ // Add source for large image (for screens >= 1200px)
+ $post_thumb .= '';
+
+ // Add source for medium image (for screens >= 768px)
+ $post_thumb .= '';
+
+ // Add fallback image (for smaller screens or if no match for media queries)
+ $post_thumb .= '
';
+
+ $post_thumb .= '';
+ }
+
+ $has_background_image = (2 + 2 == 4) ? 'lcp-has-background-image' : '';
// Output the content wrapped in the div with the random class and padding styles
return $style_tag . sprintf(
- '%s
',
- esc_attr( $random_class ),
- $content
+ '%s%s
',
+ esc_attr( $random_class ), // The random class
+ esc_attr( $has_background_image), // Conditionally add 'lcp-has-background-image' class
+ $post_thumb, // Add the $post_thumb (responsive image) here,
+ $content // Keep the original content
);
+
}
diff --git a/includes/blocks/lcp-dynamic-container/src/save.js b/includes/blocks/lcp-dynamic-container/src/save.js
index 813166b..a6f0e78 100644
--- a/includes/blocks/lcp-dynamic-container/src/save.js
+++ b/includes/blocks/lcp-dynamic-container/src/save.js
@@ -1,12 +1,4 @@
-import { useBlockProps, InnerBlocks } from '@wordpress/block-editor';
-
-export default function Save() {
- // Block props
- const blockProps = useBlockProps.save();
-
- return (
-
-
-
- );
-}
+import { InnerBlocks } from '@wordpress/block-editor';
+export default function save() {
+ return (); // No content is saved in the database for dynamic blocks
+}
\ No newline at end of file
diff --git a/includes/blocks/lcp-dynamic-container/src/style.scss b/includes/blocks/lcp-dynamic-container/src/style.scss
index e19fc0b..fe755e9 100644
--- a/includes/blocks/lcp-dynamic-container/src/style.scss
+++ b/includes/blocks/lcp-dynamic-container/src/style.scss
@@ -10,3 +10,20 @@
color: #fff;
padding: 2px;
}
+
+.lcp-dynamic-container.lcp-has-background-image {
+ position:relative;
+ width:100%;
+}
+
+.lcp-dynamic-container.lcp-has-background-image > .lcp-background-image {
+
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ object-fit: cover; /* Cover the container like a background */
+ object-position: center center; /* Center the image */
+
+}
\ No newline at end of file
diff --git a/includes/blocks/lcp-gallery/build/block.json b/includes/blocks/lcp-gallery/build/block.json
index 547b6b9..64affc9 100644
--- a/includes/blocks/lcp-gallery/build/block.json
+++ b/includes/blocks/lcp-gallery/build/block.json
@@ -9,9 +9,16 @@
"description": "A dynamic or static gallery based on the Lightgallery javascript plugin",
"example": {},
"supports": {
- "html": false
+ "html": false,
+ "color": {
+ "background": true,
+ "text": false
+ }
},
"attributes": {
+ "backgroundColor": {
+ "type": "string"
+ },
"parseElementForItems": {
"type": "boolean",
"default": false
diff --git a/includes/blocks/lcp-gallery/lcp-gallery.php b/includes/blocks/lcp-gallery/lcp-gallery.php
index 7feb4c2..e66e830 100644
--- a/includes/blocks/lcp-gallery/lcp-gallery.php
+++ b/includes/blocks/lcp-gallery/lcp-gallery.php
@@ -125,6 +125,30 @@ function validate_media_ids($input) {
// Return an array of Media IDs
function get_media_ids($attributes) {
+ // If post_gallery meta field
+ if (!$attributes['sources'] == "postGallery") {
+ $post_id = get_the_ID();
+ $lcp_post_gallery = get_post_meta( $post_id, 'lcp_gallery', true );
+
+ // Check if the meta field is not empty and unserialize the value
+ if ( ! empty( $lcp_post_gallery ) ) {
+ // Unserialize the meta field value to convert it into an array
+ $gallery_array = $lcp_post_gallery;
+
+ // Initialize an empty array to hold the media IDs
+ $media_ids = array();
+
+ // Loop through the gallery array and extract the media_id values
+ foreach ( $gallery_array as $item ) {
+ // Check if the 'media_id' key exists
+ if ( isset( $item['media_id'] ) ) {
+ $media_ids[] = $item['media_id']; // Add the media_id to the array
+ }
+ }
+ }
+
+ return $media_ids;
+ }
// Manual Source
if ($attributes['source'] == "manual" && isset($attributes['galleryItems'])) {
// Extract 'id' from each item in the 'galleryItems' array
diff --git a/includes/blocks/lcp-gallery/src/edit.js b/includes/blocks/lcp-gallery/src/edit.js
index 3de96af..c8efcea 100644
--- a/includes/blocks/lcp-gallery/src/edit.js
+++ b/includes/blocks/lcp-gallery/src/edit.js
@@ -2,7 +2,10 @@ import { __ } from '@wordpress/i18n';
import {
InspectorControls,
MediaUpload,
- MediaUploadCheck
+ MediaUploadCheck,
+ useBlockProps,
+ withColors,
+ PanelColorSettings
} from '@wordpress/block-editor';
import { useState,
useEffect,
@@ -65,9 +68,6 @@ const galleryElements = [
]
-
-
-
// Aspect ratio options
const aspectRatioOptions = [
{ value: '1-1', label: __('1:1', metadata.textdomain) },
@@ -125,8 +125,8 @@ const MultiMediaUpload = ({ onSelect }) => {
);
};
-export default function Edit(props) {
- const { attributes, setAttributes } = props;
+function Edit(props) {
+ const { attributes, setAttributes, backgroundColor, setBackgroundColor } = props;
const {
galleryItems = [],
source,
@@ -314,11 +314,17 @@ const { isTemplate, postType, postId } = useSelect((select) => {
togglePlugin('lgZoom', value); // Add/Remove lgZoom plugin based on toggle value
};
+ const blockProps = useBlockProps({
+ style: {
+ backgroundColor: backgroundColor?.color,
+ },
+ });
+
return (
<>
{/* The Gallery */}
-
+
{/* Settings and Style Tabs */}
@@ -717,6 +723,16 @@ const { isTemplate, postType, postId } = useSelect((select) => {
if (name === 'style') {
return (
+
{initialLayout === 'inline' && (
<>
{
);
}
+export default withColors('backgroundColor')(Edit);
diff --git a/includes/classes/wp-hooks.php b/includes/classes/wp-hooks.php
index 5c72147..567312e 100644
--- a/includes/classes/wp-hooks.php
+++ b/includes/classes/wp-hooks.php
@@ -82,4 +82,31 @@ function lcp_after_setup_theme() {
lcp_register_custom_image_sizes();
}
-add_action('after_setup_theme', 'lcp_after_setup_theme');
\ No newline at end of file
+add_action('after_setup_theme', 'lcp_after_setup_theme');
+
+function lcp_init_hooks() {
+ lcp_register_pattern_categories();
+ lcp_register_patterns();
+}
+
+add_action('init', 'lcp_init_hooks');
+
+// Register pattern categories
+function lcp_register_pattern_categories() {
+ register_block_pattern_category( 'lcp/customss', array(
+ 'label' => __( 'Theme Name: Local Content Pro', 'lcp' ),
+ 'description' => __( 'Custom patterns for Local Content Pro.', 'lcp' )
+ ) );
+}
+
+// Register block pattern
+function lcp_register_patterns() {
+ register_block_pattern(
+ 'lcp/post-content', // Unique slug
+ array(
+ 'title' => __( 'Post Content', 'lcp' ),
+ 'description' => __( 'A pattern for displaying post content', 'lcp' ),
+ 'content' => file_get_contents( get_template_directory() . '/patterns/post-content.php' ),
+ )
+ );
+}
\ No newline at end of file
diff --git a/patterns/post-content.php b/patterns/post-content.php
new file mode 100644
index 0000000..4c1aada
--- /dev/null
+++ b/patterns/post-content.php
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/theme.json b/theme.json
index c63fc04..6e324e5 100644
--- a/theme.json
+++ b/theme.json
@@ -44,18 +44,23 @@
},
{
"color": "#00E080",
- "name": "Accent",
- "slug": "accent"
+ "name": "Accent - 1",
+ "slug": "accent-1"
},
{
"color": "#00FC90",
- "name": "Accent 2",
- "slug": "accent-2"
+ "name": "Accent Light - 1",
+ "slug": "accent-light-1"
},
{
"color": "#232323",
"name": "Font 1",
"slug": "font-color-1"
+ },
+ {
+ "color": "#a0a0a0",
+ "name": "Font Light 1",
+ "slug": "font-light-1"
}
]
},
@@ -201,6 +206,7 @@
"useRootPaddingAwareAlignments": true
},
"styles": {
+
"color": {
"background": "var:preset|color|base",
"text": "var:preset|color|contrast"
@@ -214,7 +220,7 @@
},
"typography": {
"fontFamily": "var:preset|font-family|manrope",
- "fontSize": "var:preset|font-size|large",
+ "fontSize": "var:preset|font-size|medium",
"fontWeight": "300",
"letterSpacing": "-0.1px",
"lineHeight": "1.4"