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 | |
//devolum.com | |
// copy this code to functions.php to create query var 'sort' | |
// function add_query_vars_filter( $vars ){ | |
// $vars[] = "sort"; | |
// return $vars; | |
// } |
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 | |
add_filter( 'pre_get_posts', 'chage_query_for_posts' ); | |
function chage_query_for_posts( $query ) { | |
if ( ! is_admin() && $query->is_main_query() ) { // this work for all wordpress posts, you can use is_category or is_page or any if case you need this function work for! | |
$query->set( | |
'posts_per_page' => 50, | |
'cache_results' => false |
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 | |
add_filter( 'pre_get_posts', 'chage_query_for_posts' ); | |
function chage_query_for_posts( $query ) { | |
if ( ! is_admin() && $query->is_main_query() ) { // this work for all wordpress posts, you can use is_category or is_page or any if case you need this function work for! | |
$query->set( | |
'posts_per_page' => 50, | |
'cache_results' => false |
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 post_on_publish( $post_id ) { | |
if ( get_post_status($post_id) == 'publish'){ // I have some issues with posting none published the post so this will check if the post already published. | |
// your custom function here | |
} | |
} | |
add_action( 'draft_to_publish', 'post_on_publish' ); | |
add_action( 'new_to_publish', 'post_on_publish' ); |
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 | |
// Handle firebase send the request over 100 token by sent them 99 by 99 token. | |
// just use this function with $tokens_array and $data and run your firebase | |
// firebase function here : https://gist.github.com/alaanasssar/3ccb64133a1891e36abbdcbec0c45d4f | |
function handle_firebase_fcm ($tokens_array , $data , $google_api_key){ | |
$tokens_array = array_chunk($tokens_arr, 99); | |
foreach ($tokens_array as $tokens) { | |
Firebase_notifications_fcm($tokens, $data, $google_api_key) |
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 | |
$args = array( | |
// Normal query goes here // | |
'no_found_rows' => true, // counts posts, remove if pagination required | |
'update_post_term_cache' => false, // grabs terms, remove if terms required (category, tag...) | |
'update_post_meta_cache' => false, // grabs post meta, remove if post meta required | |
); |
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 | |
/* Upload this file to the root of your wp-content folder. | |
* Domain : maintenance | |
* | |
* For style the page - Don't forget to remove this comment. | |
* | |
* function _e( $text, $domain = 'default' ) { | |
* echo $text ; | |
* } |
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 | |
/* Firebase_notifications_fcm | |
* How to use | |
* To use the function you need to have ($tokens, $data , $google_api_key) | |
* $google_api_ke after create an app in firebase you need to find Google Api Key | |
* $tokens an Array with devices tokens | |
* $data an Array with the data you will send with ( title , message ) for example | |
*/ |