This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // phpcs:ignore Class file names should be based on the class name with "class-" prepended. | |
// Exit if accessed directly. | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; | |
} | |
/** | |
* WP_Plugin_Pattern Class | |
* | |
* Handles the management of block patterns for the plugin. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Register block binding sources. | |
*/ | |
if ( ! function_exists( 'prefix_register_block_bindings' ) ) : | |
/** | |
* Register the archive title binding source. | |
* | |
* @since Project Name 1.0.0 | |
* @return void | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Programmatically install and activate WordPress plugins. | |
* Supports installation of plugins from the WordPress plugin repository and external sources via ZIP files. | |
*/ | |
if ( ! function_exists( 'prefix_is_plugin_active' ) ) { | |
/** | |
* Checks if a given plugin is active. | |
* | |
* @since 1.0.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
registerBlockVariation('core/paragraph', { | |
name: 'prefix-project/prefix-field', | |
title: __('Prefix field', 'text-domain'), | |
description: __('Displays the Prefix field.', 'text-domain'), | |
category: 'text', | |
keywords: ['prefix', 'project', 'field'], | |
scope: ['inserter'], | |
attributes: { | |
metadata: { | |
bindings: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*WordPress*/ | |
import { | |
useEffect, | |
useRef, | |
useState | |
} from "@wordpress/element"; | |
/*Library*/ | |
import { | |
cloneDeep |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import apiFetch from "@wordpress/api-fetch"; | |
export const fetchMedia = async (id) => { | |
let path = 'wp/v2/media/'+id, | |
media ={}; | |
try { | |
media = await apiFetch({ | |
path: path, | |
method : 'GET' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*STYLIS : https://www.npmjs.com/package/stylis*/ | |
import {compile, serialize, stringify, middleware, prefixer} from 'stylis'; | |
/*Process the Raw CSS*/ | |
const getProcessedCss = (rawCss) =>{ | |
return serialize(compile(rawCss), middleware([prefixer, stringify])) | |
} | |
/*Render CSS inside style tag*/ | |
const RenderCss = (props) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*Remove all image sizes*/ | |
function prefix_remove_image_sizes( $sizes ) { | |
return array(); | |
} | |
add_action( 'intermediate_image_sizes_advanced', 'prefix_remove_image_sizes' ); | |
/*Removed scaled image size (-scaled as suffix on image name)*/ | |
add_filter( 'big_image_size_threshold', '__return_false' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Get Post/Post Type Count in the given Taxonomy | |
* | |
* @param $post_type string any post type | |
* @param $taxonomy string any taxonomy | |
* @param $is_exists string NOT EXISTS or EXISTS | |
* | |
* @return String Number of Post count | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add Category Dynamic Css | |
* | |
* Edit the selector on the function | |
* Change Selector as your theme/plugin | |
*/ | |
if ( ! function_exists( 'prefix_get_post_categories_color' ) ) { | |
function prefix_get_post_categories_color( $imp = false) { |
NewerOlder