Month: November 2024

Dynamic Block without Render PHP

User we have created npx @wordpress/create-block@latest –namespace="my-plugin" –slug="my-block" –variant="dynamic" but don't want to use render.php Assistant If you've created a dynamic block using `npx @wordpress/create-block` and prefer not to use `render.php`, you can utilize the `render_callback` function in your block's registration to handle server-side rendering directly in your block's JavaScript file. Here’s how you can […]

Dynamic and Static WP Blocks

User how to use both dynamic and static rendering wp blocks Assistant Using both dynamic and static rendering in WordPress blocks allows for a mix of client-side flexibility and server-side consistency. Here’s how to set up both types of blocks: ### 1. Static Rendering Static blocks are primarily used when content does not need to […]

Gutenberg Block Current Year

User wp gautenberg block react show year Assistant To create a custom Gutenberg block in WordPress that displays the current year using React, you'll need to follow these steps. This example assumes you are using the Sage 10 theme with a setup that includes Webpack and React for your Gutenberg blocks. ### Step 1: Register […]

Chown Command for www-data

User chown www-data Assistant The `chown` command in Unix/Linux is used to change the ownership of files or directories. If you're looking to change the ownership of a file or directory to the `www-data` user (commonly used by web servers like Apache or Nginx), you would use the following syntax: sudo chown www-data:www-data /path/to/your/file_or_directory Here's […]

Preventing Past Dates jQuery

User jQuery('#start_date_time,#end_date_time').datetimepicker({ format: 'd-m-Y H:i', }); prevent old dates Assistant To prevent users from selecting past dates in your jQuery datetimepicker, you can set the `minDate` option to the current date and time. Here’s how you can modify your existing code: jQuery('#start_date_time, #end_date_time').datetimepicker({ format: 'd-m-Y H:i', minDate: 0, // Prevents selection of past dates }); […]

Gutenberg Block Live Reloading

User { "name": "nt-block", "version": "0.1.0", "description": "Example block scaffolded with Create Block tool.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", "main": "build/index.js", "scripts": { "build": "wp-scripts build –webpack-copy-php", "format": "wp-scripts format", "lint:css": "wp-scripts lint-style", "lint:js": "wp-scripts lint-js", "packages-update": "wp-scripts packages-update", "plugin-zip": "wp-scripts plugin-zip", "start": "wp-scripts start –webpack-copy-php" }, "devDependencies": { "@wordpress/scripts": "^30.4.0" }, "dependencies": { […]

Remove defaultProps Warning

User Warning: _o: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead. in wp block custom blocks Assistant The warning you're seeing indicates that the usage of `defaultProps` in function components will be deprecated in a future version of React. Instead of defining default properties […]

Child Theme Sage 10

User create child theme of root sage 10 Assistant Creating a child theme for Sage 10 (a WordPress starter theme by Roots) allows you to customize your site without modifying the parent theme directly. Here’s how you can create a child theme for Sage 10: ### Step 1: Create the Child Theme Directory 1. **Navigate […]

Fix jQuery Not Defined

User root sage theme 10 jquery not defined wordpress 6.6.2 Assistant If you're encountering a "jQuery not defined" error while using the Sage theme (version 10) with WordPress 6.6.2, it’s likely due to how jQuery is being enqueued or loaded in your theme. Sage 10 uses a modern JavaScript setup with ES6, and it doesn't […]

Using Sans in Tailwind

User root sage theme tailwind config module.exports = { content: ['./index.php', './app/**/*.php', './resources/**/*.{php,vue,js}'], theme: { extend: { colors: {}, + fontFamily: { + sans: 'Public Sans, sans-serif', + }, }, }, plugins: [], }; how to use sans in theme files Assistant To use the custom `sans` font family defined in your Tailwind CSS configuration […]