View functions.php
This file contains 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 | |
/* | |
Debug preview with custom fields | |
Taken from: http://support.advancedcustomfields.com/forums/topic/preview-solution/ | |
See also: http://support.advancedcustomfields.com/forums/topic/2nd-every-other-post-preview-throws-notice/ | |
*/ | |
add_filter('_wp_post_revision_fields', 'add_field_debug_preview'); | |
function add_field_debug_preview($fields){ | |
$fields["debug_preview"] = "debug_preview"; | |
return $fields; |
View custom-feed.php
This file contains 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 | |
/** | |
* Create custom function and custom rss template. | |
* URL : /feed/feedname | |
* When url 404 not found, please open permalink setting then try again. | |
*/ | |
add_action('init', 'customRSS'); | |
function customRSS(){ | |
add_feed('feedname', 'customRSSFunc'); |
View auto-regenerate-thumb.php
This file contains 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 | |
require_once(ABSPATH . 'wp-admin/includes/image.php'); | |
// Put the function in a class to make it more extendable | |
class KRS_regen_media | |
{ | |
public function krs_regenerate($imageId) | |
{ | |
$imagePath = wp_get_original_image_path($imageId); |
View withPrice.php
This file contains 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 | |
public function scopeWithPrice($smartphone) | |
{ | |
$queryGetMinPrice = $smartphone->select([ | |
'*', | |
'price' => ProductPrice::select('price')->where('priceable_type', Smartphone::class)->whereColumn('priceable_id', 'smartphones.id')->orderBy('price', 'ASC')->take(1) | |
]); | |
return $queryGetMinPrice; | |
} |
View preview_input_file_image.js
This file contains 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
<input type="file" accept="image/*" onchange="loadFile(event)"> | |
<img id="output"/> | |
<script> | |
var loadFile = function(event) { | |
var output = document.getElementById('output'); | |
output.src = URL.createObjectURL(event.target.files[0]); | |
output.onload = function() { | |
URL.revokeObjectURL(output.src) // free memory | |
} | |
}; |
View docker-compose.yml
This file contains 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
# Run legacy PHP 5.3 and MySQL 5.1 on Docker | |
version: '3.7' | |
services: | |
php: | |
container_name: 'php-5.3.29-apache' | |
depends_on: | |
- mysql | |
image: php:5.3.29-apache | |
volumes: | |
- ./www:/var/www |
View functions.php
This file contains 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 | |
// Removes from admin menu | |
add_action( 'admin_menu', 'my_remove_admin_menus' ); | |
function my_remove_admin_menus() { | |
remove_menu_page( 'edit-comments.php' ); | |
} | |
// Removes from post and pages | |
add_action('init', 'remove_comment_support', 100); | |
function remove_comment_support() { |
View functions.scss
This file contains 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
// Shade a color: mix a color with black | |
// Example : shade-color($color__btn-primary, 10%) | |
@function shade-color($color, $weight) { | |
@return mix(black, $color, $weight); | |
} |
View hide-plugin-network.php
This file contains 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 mu_hide_plugins_network( $plugins ) { | |
// let's hide akismet | |
if( in_array( 'akismet/akismet.php', array_keys( $plugins ) ) ) { | |
unset( $plugins['akismet/akismet.php'] ); | |
} | |
return $plugins; | |
} | |
add_filter( 'all_plugins', 'mu_hide_plugins_network' ); |
View hide-plugin.php
This file contains 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 hide_plugin_kerjadev() { | |
global $wp_list_table; | |
$hidearr = array('plugin-directory/plugin-file.php'); | |
$myplugins = $wp_list_table->items; | |
foreach ($myplugins as $key => $val) { | |
if (in_array($key,$hidearr)) { | |
unset($wp_list_table->items[$key]); | |
} | |
} |
NewerOlder