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 | |
function settings_fields() { | |
$children['tab'] = new Fieldmanager_Group( array( | |
'label' => 'ABCD', // This name must match what we registered in `fm_register_submenu_page()` | |
'children' => array( | |
'text' => new Fieldmanager_Textfield( 'Text Field' ), | |
'autocomplete' => new Fieldmanager_Autocomplete( 'Autocomplete', array( 'datasource' => new Fieldmanager_Datasource_Post() ) ), | |
'textarea' => new Fieldmanager_TextArea( 'TextArea' ), | |
'media' => new Fieldmanager_Media( 'Media File' ), |
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_action( 'pre_get_posts', array( $this,'function_pre_get_posts' ) ); | |
function function_pre_get_posts(){ | |
// you can't use the query->set here for tax_query | |
// as tax query has already been made | |
// so you need to need add youself to any | |
// existing tax query | |
$tax_query = array( | |
'taxonomy' => 'tax_name', |
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 | |
/* | |
* Plugin Name: Paulund WP List Table Example | |
* Description: An example of how to use the WP_List_Table class to display data in your WordPress Admin area | |
* Plugin URI: http://www.paulund.co.uk | |
* Author: Paul Underwood | |
* Author URI: http://www.paulund.co.uk | |
* Version: 1.0 | |
* License: GPL2 | |
*/ |
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 | |
/** | |
* Change `the_content` thing in below function with your hook in filter | |
* - You can change $wp_filter to $wp_actions to get details of action hooks. | |
* | |
* NOTE: THIS IS FOR ONLY DEBUG PURPOSE NOT SEND THIS CODE TO PRODUCTION. | |
*/ | |
function vk_list_hooks() { | |
global $wp_filter; |
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 | |
/** | |
* Plugin Name: All Options Limit for WordPress | |
* Description: Provides warnings and notifications for wp_options exceeding limits. | |
* Author: Vishal | |
* License: GPL version 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html | |
*/ | |
/** |
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 | |
/** | |
Details: Basically This plugin is providing support of Query Monitor with HyperDB. | |
*/ | |
/** | |
Warning: This plugin file is partially working, you must try this first on development environment and check everything and then only use this for Production. | |
Warning: USE THIS AT YOUR OWN RISK, Thank You! | |
*/ |
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
// JUST run below code in your browser's console, in the browser's tab where PR is open. | |
var x = document.getElementsByClassName("js-details-container"); | |
var i; | |
for (i = 0; i < x.length; i++) { | |
x[i].className = x[i].className.replace(/\bDetails--on\b/g, ""); | |
x[i].className = x[i].className.replace(/\bopen\b/g, ""); | |
} |
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 | |
/** | |
* Some time we get in situation where we have to replace specific string from whole site, | |
* Like if you are using WooCommerce for donation purpose and you want to display | |
* `donation` text in place of `order` text then I have ideal way to do this by below code. | |
*/ | |
/** | |
* Filters text with its translation. |
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
/** | |
* Below is the small trick to fix conflicts between FieldManager's Autocomplete, Datepicker and RichText_Area with Gutenberg block editor. | |
*/ | |
$( window ).load( function() { | |
// NOTE: This is fix for fieldmanager datepicker and autocomplete. | |
// Ref: https://github.com/alleyinteractive/wordpress-fieldmanager/issues/713 . | |
if ( typeof fm !== "undefined" ) { | |
if ( typeof fm.datepicker !== "undefined" ) { |
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 | |
/** | |
* Sometime we need to take input from user with Field Manager's TextArea field, FM is using sanitize_text_field](https://api.fieldmanager.org/source-class-Fieldmanager_Field.html#123) | |
* So below is the code to bypass or use your own validation logic. | |
*/ | |
$fm = new \Fieldmanager_TextArea( | |
array( | |
'name' => '_vk_videoembed_manual', | |
'sanitize' => 'validate_embed_field', // Link your own validation function here. |