Skip to content

Instantly share code, notes, and snippets.

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

Angel Costa angelcosta

🏠
Working from home
View GitHub Profile
@angelcosta
angelcosta / plugin.php
Created August 9, 2022 13:48
some wp things
<?php
// Comentários
add_action('comment_post', 'doceblog_envia_notificacao', 10, 2);
function doceblog_envia_notificacao($comment_id, $approved) {
if ($approved) {
$filho = get_comment($comment_id);
if ($filho->comment_parent) {
$pai = get_comment($filho->comment_parent);
$pai_autor = $pai->comment_author;
@angelcosta
angelcosta / index-subs.php
Last active August 17, 2022 22:52
Sendy - Subscribers counter on homepage
<?php include('includes/header.php');?>
<?php include('includes/login/auth.php');?>
<?php
check_simplexml();
if(get_app_info('is_sub_user'))
{
echo '<script type="text/javascript">window.location="'.addslashes(get_app_info('path')).'/app?i='.get_app_info('restricted_to_app').'"</script>';
exit;
}
@angelcosta
angelcosta / mailerlitecounter.php
Last active May 10, 2021 16:44
MailerLite - Subscribers counter
//Add this to your functions.php then use the shortcode [assinantes] to show your list numbers
function assinantes_madmimi() {
$transient = get_transient( 'assinantes_madmimi' );
if( ! empty( $transient ) ) {
return $transient;
} else {
$username = "your email at madmimi";
$apikey = "your api key";
$response = wp_remote_retrieve_body( wp_remote_get( "https://api.madmimi.com/audience_members.json?username=$username&api_key=$apikey" ) );
@angelcosta
angelcosta / content-download-email.php
Last active May 10, 2021 16:46
Download Monitor - Send as download as attachment template
<?php
/**
* Send download to user's email
*/
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
/*$versions = $dlm_download->get_file_versions();
reset($versions);
$version = key($versions);
@angelcosta
angelcosta / madmimi.php
Last active May 10, 2021 16:41
MadMimi - Subscribers counter
//Add this to your functions.php then use the shortcode [mmsubscribers] to show your list numbers
function subscribers_madmimi() {
$transient = get_transient( 'subscribers_madmimi' );
if( ! empty( $transient ) ) {
return $transient;
} else {
$username = "your email at madmimi";
$apikey = "your api key";
$response = wp_remote_retrieve_body( wp_remote_get( "https://api.madmimi.com/audience_members.json?username=$username&api_key=$apikey" ) );