Skip to content

Instantly share code, notes, and snippets.

View khromov's full-sized avatar

Stanislav Khromov khromov

View GitHub Profile
@khromov
khromov / keybase.md
Created October 14, 2014 20:09
keybase.md

Keybase proof

I hereby claim:

  • I am khromov on github.
  • I am khromov (https://keybase.io/khromov) on keybase.
  • I have a public key whose fingerprint is 8A0D 8C75 FCCE FACE 4053 88C5 8F7D 1DB4 F63C 1D5C

To claim this, I am signing this object:

@khromov
khromov / dfp-head.html
Last active August 29, 2015 14:08
dfp-head.html
<!-- IDG DFP wp_head -->
<script type="text/javascript">
var gptadslots = [];
/* Only load ads on the initial page load, although enquire may try to run the again if user resizes their window */
var dfpIsInitialPageLoad = true;
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
var dfpUnitName = "<?=$DFP_UNIT_NAME?>";
@khromov
khromov / include_templates.php
Created October 27, 2014 23:27
Include theme templates from plugin, WordPress
<?php
/**
* Helper function for including templates
*
* @param $template
*/
function include_template($template, $args)
{
extract($args);
@khromov
khromov / acf-create.php
Created November 4, 2014 12:42
ACF PRO create post on frontend
<?php
acf_form(array(
'id' => 'your-form',
'post_id' => 'new_post',
'new_post' => array(
'post_type' => 'post',
'post_status' => 'publish',
'post_author' => get_current_user_id()
),
'field_groups' => array('group_544f441dc5661', 'group_544f49a3060b0', 'group_5451dc41933e4'), //Your ACF groups
@khromov
khromov / acf-link-picker-shortcode.php
Last active March 27, 2018 04:24
ACF Link Picker Shortcode
$tmp = function() {
?>
<?php
};
@khromov
khromov / image-default-size.php
Created December 29, 2014 06:20
Change default image size in Add Media (Insert image) dialogue in WordPress
<?php
add_filter('pre_option_image_default_size', function($value)
{
return 'large'; //Set to whatever you wish
});
@khromov
khromov / capital_p_dangit_perf.php
Last active August 29, 2015 14:13
capital_P_dangit performance impact tester
<?php
/*
Plugin Name: capital_P_dangit performance test
Plugin URI:
Description: Use shortcode on any page: [capital_P_dangit_performance count="10000"]
Version: 1.0
Author: khromov
Author URI: http://snippets.khromov.se
License: GPL2
*/
<?php
/*
Plugin Name: Your Plugin
Plugin URI: http://snippets.khromov.se/a-nicer-way-to-structure-your-plugin/
Description: Your plugin skeleton
Version: 1.0
Author: you
Author URI: http://your-site.com
License: GPL2
*/
@khromov
khromov / spp.php
Last active April 13, 2023 17:36
Count post view counts in WordPress via AJAX (Compatible with caching plugins)
<?php
/*
Plugin Name: Simple Popular Posts Lite
Plugin URI: -
Description: -
Version: 2015.03.01
Author: khromov
Author URI: http://snippets.khromov.se
License: GPL2
*/