Skip to content

Instantly share code, notes, and snippets.

View stefanmm's full-sized avatar
🏠
Working from home

Stefan stefanmm

🏠
Working from home
View GitHub Profile
@stefanmm
stefanmm / functions.php
Created May 17, 2022 12:49
ACFBS - search by ACF fields only
function stfn_acfbs_post_fields( $fields ) {
// default lista: ['post_title', 'post_content', 'post_excerpt']
$fields = [];
return $fields;
}
add_filter( 'acfbs_search_post_object_fields', 'stfn_acfbs_post_fields', 10, 1 );
@stefanmm
stefanmm / functions.php
Created May 17, 2022 12:48
WP pass single post title to email subject
echo '<a href="mailto:nekimejl@domen.com?subject='.get_the_title( get_the_ID() ).'">Pošalji email</a>';
@stefanmm
stefanmm / functions.php
Last active May 17, 2022 14:49
Edit WP cookie expiration
add_filter( 'auth_cookie_expiration', 'keep_me_logged_in_for_2_weeks', 99, 1 );
function keep_me_logged_in_for_2_weeks( $expire ) {
return 1209600; // 2 weeks in seconds
}
@stefanmm
stefanmm / server.js
Created July 1, 2019 11:04
Dialogflow + Facebook Messenger: handle stickers and images (node.js)
/*
some code...
*/
function imagesFunc(agent) {
const sticker_id = agent.request_.body.originalDetectIntentRequest.payload.data.message.sticker_id; // get "sticker_id"
if (sticker_id != undefined) { // it's a sticker
agent.add("That is nice sticker!"); // send answer to user
} else { // it is not a sticker
agent.add("Thank you for image!"); // send answer to user
}