Questions tagged [react]
The react tag has no summary.
68 questions
0
votes
0
answers
14
views
SSR for Cart Content [closed]
Are there any option or hack to show initial cart content without reactjs? I mean the products and total sum blocks, no need to be full page. Those elements are generated after page load, which is ...
0
votes
0
answers
24
views
The page jumps to top back when you scroll down, if paragraph block is selected in custom child block
Need a little help to solve the behavior issue.
I’ve developed two custom Gutenberg blocks — a parent block and a child block. When a user clicks a paragraph block inside the custom child block and ...
0
votes
0
answers
23
views
How to make a drop down panel in the editor that writes to the post's custom fields without updating the post(wp 5.8)
I want a sidebar panel in the post editor where a user can pick an assignee and an editor for a post. The post will be populated by a list of every user on the site. When the page loads, I want the ...
2
votes
1
answer
94
views
How to include block style variations for blocks in posts dynamically rendered via the Interactivity API
I'm building a block that shows an infinite list of posts using the Interactivity API:
render.php
<?php
$block_attributes = get_block_wrapper_attributes()
?>
<div
<?php echo $...
2
votes
0
answers
47
views
WordPress Dataviews React multilanguage i18n
I'm using React WP dataviews component in my plugin, but I can't load translation for the component.
OFFICIAL DOCS
I loaded plugin translation into php file with:
function umc_load_textdomain() {
...
0
votes
0
answers
55
views
Add a React search box to blog home error - Cannot read properties of undefined (reading 'jsx')
I have followed a couple of tutorials online in the pursuit of adding a react component to my WP page.
I have gone over and over it for errors and I cant see what I must be missing, as the console ...
1
vote
0
answers
84
views
How to expose hooks to @wordpress/hooks?
I'm trying to hook into wp_handle_upload_prefilter with JavaScript, but I must be doing it wrong.
Here's my code:
add_action(
'admin_enqueue_scripts',
'enqueue_backend_scripts',
);
public ...
0
votes
2
answers
221
views
How to auto rename JS files to prevent browser cache issues
Im creating a block plugin in worpress and each time I update my JS files, changes do not reflect to frontend because there's a browser cache.
I found some strategies in others frameworks that rename ...
0
votes
0
answers
69
views
Gutenberg Dev - React Context.Provider returns undefined
I have a Context.Provider with a value setup in slider/edit.js.
When I import it in the child component slide/edit.js with useContext it returns undefined
I don't see what I'm missing here
For context ...
1
vote
0
answers
122
views
Extend WordPress Gutenberg core/navigation-link
Hey folks So Im pretty new to this react + php in wordpress and I found one article where it showed how to extend a core block, which works fine for group and some basic block but When i tried to ...
1
vote
1
answer
313
views
How to transform a shortcode into a block
I've built the following Gutenberg block. It's a carousel of images:
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import {
G,
Path,
SVG,
ToolbarGroup,
...
2
votes
1
answer
409
views
Gutenberg Static blocks: viewScript doesn't import css for frontend?
I am building static block slider (Swiper JS). Used wordpress/create-block https://developer.wordpress.org/block-editor/reference-guides/packages/packages-create-block/.
Besides importing the JS & ...
1
vote
1
answer
251
views
Hook into viewport change?
i have create a component that will update the viewport "Mobile, Tablet, Desktop" above.
Of course, the user could also change the viewport on the top, but than my settings not synchron to ...
0
votes
1
answer
553
views
How to detect changes in WooCommerce store (react)?
Since WooCommerce merged blocks in the plugin, the cart is now completely 'reactified'. Meaning I update the quantity on my cart, I see a network call to an endpoint, thigs update without reloading, ...
1
vote
1
answer
215
views
Can you nest columns/column in a gutenberg custom template?
I am trying to nest a core columns within a core/columns /core/column template. I keep getting an error that block can't render. However looking at my code it looks fine. [I've simplified the code] So,...
2
votes
1
answer
1k
views
How to add an additional dependency to a block index.asset.php file
I have a plugin that registers four different Gutenberg blocks. I build them using the build script from the wp-scripts package. As you all surely know, this script automatically generates an index....
1
vote
0
answers
139
views
Core/Image access caption in render_template and in wp.hooks
I am making an override to core/image block -disabling styles, changing markup and such.
I have managed to solve some things, but struggle with some others.
Here is my code:
filters.php
<?php
use ...
1
vote
0
answers
158
views
Custom plugin translation not working
I made a plugin that contains 2 custom gutenberg blocks created with react and jQuery (for some front-end stuff) and I'm having troubles translating them. There are no translation strings inside the ...
2
votes
1
answer
376
views
How to build BOTH non-block components and blocks present in the /src directory using @wordpress/scripts
I regularly use @wordpress/scripts for building both blocks and non-block components. Recently, I started working in a new plugin that registers both some blocks and non-block components that add ...
0
votes
0
answers
284
views
Embedded data and the _fields parameter in getEntityRecords
I'm using the following code to retrieve a list of post of a custom post type named movie:
const { posts, hasPostsResolved } = useSelect(select => {
const query = {
order: 'desc',
...
0
votes
0
answers
235
views
Get realtime title and featured image value in Wordpress block
I'm building a WordPress block in React, and I need the title and featured image to be displayed in the block. So I need a way to get the title value and the featured img URL in real time, so it ...
0
votes
1
answer
395
views
Removing Default Panels From Gutenberg Document Setting Panel (sidebar)
Here's a second question in my quest to understand the Gutenberg Document Settings Panel sidebar and customize it. (See my first question here.)
I have the following jsx code working for the edit ...
0
votes
1
answer
493
views
Masonry gallery block is working in the block editor but not the template editor
I'm building a custom Masonry (non-jQuery version) gallery block and I managed to make it work in the block editor. I'm using WP 6.3. This is roughly the code:
JS:
const containerRef = useRef(null);
...
0
votes
2
answers
669
views
How to implement Mapbox GL JS with a custom Gutenberg block in FSE?
I'm working on a custom Gutenberg block that uses the Mapbox GL JS API for displaying a map. To create the map I have to call the following constructor.
const map = new mapboxgl.Map({
container: '...
0
votes
0
answers
42
views
How to access WP header from Appearance > Header using WP Rest api (React)
Need to use the WordPress Header Section in react js. No plugin is used for plugin it is by default.