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
To get the list of all post type | |
get_post_types(); | |
Output | |
Array | |
( | |
[post] => post | |
[page] => page |
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_filter( 'avatar_defaults', 'newgravatar' ); | |
function newgravatar ($avatar_defaults) { | |
$myavatar = site_url() . '/img/blog_noPhoto.jpg'; | |
$avatar_defaults[$myavatar] = "Default Avatar"; | |
return $avatar_defaults; | |
} |
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( 'init', 'init_example' ); | |
function init_example() { | |
global $wp_rewrite; | |
$wp_rewrite->author_base = 'profile'; | |
$wp_rewrite->search_base = 'find'; | |
$wp_rewrite->pagination_base = 'p'; | |
} |
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
// CSS files | |
woocommerce-layout.css | |
woocommerce-smallscreen.css | |
woocommerce.css | |
// JavaScript files | |
add-to-cart.min.js | |
jquery.blockUI.min.js | |
woocommerce.min.js | |
jquery.cookie.min.js |
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 | |
//Product Cat creation page | |
function text_domain_taxonomy_add_new_meta_field() { | |
?> | |
<div class="form-field"> | |
<label for="term_meta[wh_meta_title]"><?php _e('Meta Title', 'text_domain'); ?></label> | |
<input type="text" name="term_meta[wh_meta_title]" id="term_meta[wh_meta_title]"> | |
<p class="description"><?php _e('Enter a meta title, <= 60 character', 'text_domain'); ?></p> | |
</div> |
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 | |
/* The wp_mail_from filter modifies the "from email address" used in an email sent using the wp_mail function. | |
* auto-detect the server so you only have to enter the front/from half of the email address, including the @ sign | |
* https://codex.wordpress.org/Plugin_API/Filter_Reference/wp_mail_from | |
*/ | |
function xyz_filter_wp_mail_from($email) { | |
/* start of code lifted from wordpress core, at /wp-includes/pluggable.php */ | |
$sitename = strtolower($_SERVER['SERVER_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 | |
add_filter( 'avatar_defaults', 'newgravatar' ); | |
function newgravatar($avatar_defaults) { | |
$myavatar = get_bloginfo('template_directory') . '/img/my-custom-img.jpg'; | |
$avatar_defaults[$myavatar] = "Default Avatar"; | |
return $avatar_defaults; | |
} |
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
#To enable mod_deflate(recommended) | |
<IfModule mod_deflate.c> | |
AddOutputFilterByType DEFLATE text/html | |
AddOutputFilterByType DEFLATE text/css | |
AddOutputFilterByType DEFLATE text/javascript | |
AddOutputFilterByType DEFLATE text/xml | |
AddOutputFilterByType DEFLATE text/plain | |
AddOutputFilterByType DEFLATE image/x-icon | |
AddOutputFilterByType DEFLATE image/svg+xml | |
AddOutputFilterByType DEFLATE application/rss+xml |
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 | |
define("COMPRESS_DIR", realpath(dirname(__FILE__)) . "\compress"); //folder where all the compressed images will be stored | |
define("UPLOADS_DIR", realpath(dirname(__FILE__)) . "\uploads"); //folder where all the uploaded media/images are stored | |
//reading all the compressed files name | |
$compress_dir_files = scandir(COMPRESS_DIR); | |
$compress_dir_files = array_diff($compress_dir_files, array(".", "..")); | |
echo nl2br('Total Number of Compressed Files are: ' . count($compress_dir_files) . "\n\n"); |
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 | |
//To change secret key prsent in wp-config.php | |
//https://api.wordpress.org/secret-key/1.1/salt/ | |
//Disabling Front-End Error Logging | |
define('WP_DEBUG_DISPLAY', false); | |
//Turning Off Debugging | |
define('WP_DEBUG', false); |