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
function get_youtube_thumb($video_url) | |
{ | |
if(preg_match('/src="([^"]+)"/', $video_url, $match)) | |
$video_url = $match[1]; | |
$ytRegExp = "/^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/"; | |
preg_match($ytRegExp, $video_url, $ytMatch); | |
$large = ""; | |
if ($ytMatch && strlen($ytMatch[1]) === 11) |
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
name: Commit from workflow | |
on: | |
push: | |
branches: | |
- master | |
paths-ignore: | |
- file.txt | |
jobs: | |
build: | |
runs-on: ubuntu-latest |
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
#MYSQL import DB Snippet easy way. | |
mysql> use db_name; | |
mysql> source file_name.sql; | |
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
<ifModule mod_gzip.c> | |
mod_gzip_on Yes | |
mod_gzip_dechunk Yes | |
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$ | |
mod_gzip_item_include handler ^cgi-script$ | |
mod_gzip_item_include mime ^text/.* | |
mod_gzip_item_include mime ^application/x-javascript.* | |
mod_gzip_item_exclude mime ^image/.* | |
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.* | |
</ifModule> |
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
function customiser_init(){ | |
$post_types = array( | |
array( | |
'singular_name' => 'Financial', | |
'plural_name' => 'Financials', | |
'slug' => 'financials', | |
'post_type' => 'financials', | |
'support' => array( 'title', 'author' ), | |
), |
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 | |
/** | |
* We are hardcoding the value of the posts per page for custom post type | |
* Please only change if you know what you are doing. | |
* | |
* IF you found the other way you can change it. | |
*/ | |
function custom_posts_per_page( $query ) { | |
if (!is_admin() && is_archive('newsroom') && !is_year()) | |
$query->set( 'posts_per_page', 15 ); |
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 | |
/** | |
* @see the function ported from the WP core. | |
* @see wp_get_archives() functions for more. | |
* | |
* @author Ronak Vanpariya | |
* | |
* @param are Optional | |
* | |
* @return { array } of the object which having 'years' and 'posts' 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
<?php | |
function send_email_to_admin($post_id , $post_type ){ | |
switch ($post_type) { | |
case 'nominee-entries': | |
$terms = wp_get_post_terms( $post_id, 'award-category', array( 'fields' => 'names' ) ); | |
$uploaded_file = get_field('uploaded_file', $post_id); | |
$fields = array( | |
'%{FIRST-NAME}%' => get_field('first_name', $post_id), | |
'%{LAST-NAME}%' => get_field('last_name', $post_id), |
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 | |
/** | |
* Send Email For OTP | |
* Using WP_rand ( because it is cryptographically secure then PHP rand ). | |
*/ | |
$otp = wp_rand( 100000, 999999 ); | |
$timestemp = current_time('timestamp'); | |
/** | |
* OTP stemp Format( TimeStemp:OtpString ) for Ex. 15000000245455:465478 | |
*/ |
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( 'bbp_kses_allowed_tags', 'rew_add_mathml') ; | |
function rew_add_mathml ($allowed) { | |
$allowed['abs'] = array( | |
'abs' => true,'and' => true,'annotation' => true,'annotation-xml' => true,'apply' => true,'approx' => true,'arccos' => true,'arccosh' => true,'arccot' => true,'arccoth' => true,'arccsc' => true,'arccsch' => true,'arcsec' => true,'arcsech' => true,'arcsin' => true,'arcsinh' => true,'arctan' => true,'arctanh' => true,'arg' => true,'bind' => true,'bvar' => true,'card' => true,'cartesianproduct' => true,'cbytes' => true,'ceiling' => true,'cerror' => true,'ci' => true,'cn' => true,'codomain' => true,'complexes' => true,'compose' => true,'condition' => true,'conjugate' => true,'cos' => true,'cosh' => true,'cot' => true,'coth' => true,'cs' => true,'csc' => true,'csch' => true,'csymbol' => true,'curl' => true,'declare' => true,'degree' => true,'determinant' => true,'diff' => true,'divergence' => true,'divide' => true,'domain' => true,'domainofapplication' => true,'emptyset' => true,'eq' |