Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
wordpress-query-media
Advanced tools
Readme
This package contains a query component, along with redux state & selectors for media pulled from a WordPress site. This uses the node-wpapi
package to get your site's data via Query Components (inspired by calypso). The Query Components call the API, which via actions set your site's data into the state.
To use any of these helpers, you'll need to set your Site URL in a global (SiteSettings
), so that the API knows what site to connect to. For example:
window.SiteSettings = {
endpoint: 'url.com/path-to-wordpress',
};
Query Media is a React component used in managing the fetching of media items.
Render the component, passing in the attachmentId
. It does not accept any children, nor does it render any elements to the page. You can use it adjacent to other sibling components which make use of the fetched data made available through the global application state.
import React from 'react';
import QueryMedia from 'wordpress-query-media';
import MyMediaItem from './media-item';
export default function MyMediaComponent( { media } ) {
return (
<div>
<QueryMedia attachmentId={ 32 } />
<MyMediaItem media={ media } />
</div>
);
}
attachmentId
Type | Number |
---|---|
Required | Yes |
Default | null |
The attachment ID of the requested media item
You can import these into your project by grabbing them from the selectors
file:
import { getMedia, isRequestingMedia } from 'wordpress-query-media/lib/selectors';
getMedia( state, globalId )
isRequestingMedia( state, path )
If you need access to the reducers, action types, or action creators, you can import these from the state
file. For example, to use this in your global redux state, mix it into your reducer tree like this:
import media from 'wordpress-query-media/lib/state';
let reducer = combineReducers( { ...otherReducers, media } );
If you need to call an action (the query component should take care of this most of the time), you can pull the action out specifically:
import { requestMedia } from 'wordpress-query-media/lib/state';
View the file itself to see what else is available.
FAQs
A component for fetching WordPress media data from the REST API.
The npm package wordpress-query-media receives a total of 0 weekly downloads. As such, wordpress-query-media popularity was classified as not popular.
We found that wordpress-query-media demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.