Skip to content

Instantly share code, notes, and snippets.

View ericnicolaas's full-sized avatar
🎯
Focusing

Eric Daams ericnicolaas

🎯
Focusing
View GitHub Profile
<?php
// Get a campaign object for the campaign with ID 123.
$campaign = charitable_get_campaign( 123 );
// Get the campaign end date.
$end_date = $campaign->get_end_date();
// Get the campaign end date, formatted like this: "9 January, 2017"
// You can use any valid PHP date format. See http://php.net/manual/en/function.date.php
@ericnicolaas
ericnicolaas / campaign-queries.php
Last active April 13, 2018 02:26
Examples of campaign queries using Charitable_Campaigns
<?php
// Default usage.
//
// This will get the most recent X campaigns, where X is the
// same as the number of posts you have set to show on a blog
// page (defaults to 10).
$campaigns = Charitable_Campaigns::query();
// Only get current, active campaigns.
@devinsays
devinsays / custom-logo-update-script.php
Last active April 17, 2016 12:49
Code snippet for update script to use new theme logo
<?php
/**
* Theme Update Script
*
* Runs if version number saved in theme_mod "version" doesn't match current theme version.
*/
function prefix_update_check() {
$ver = get_theme_mod( 'version', false );