Skip to content

Instantly share code, notes, and snippets.

private function linkify($status_text){
// linkify URLs
$status_text = preg_replace(
'/(https?:\/\/\S+)/',
'<a href="\1">\1</a>',
$status_text
);
// linkify twitter users
$status_text = preg_replace(
<?php
/**
* CMB Theme Options
* @version 0.1.0
*/
class Theme_options_admin {
/**
* Option key, and option page slug
* @var string
@Robbertdk
Robbertdk / antispam_shortcode
Last active August 29, 2015 14:03
Anti spam e-mail in Wordpress
<?php
function antispambot_sc( $atts ) {
extract( shortcode_atts( array(
'email' => ''
), $atts ) );
return antispambot( $email );
}
add_shortcode( 'antispambot', 'antispambot_sc' );
// Usage: [antispambot email="my.cloaked.email.address@gmail.com"]
?>
@Robbertdk
Robbertdk / all attached image sizes
Created August 19, 2014 10:28
WordPress: Get the urls of all the attached image sizes
<?php
/**
* Get the urls of all the attached image sizes
*
* Array with image urls given when a correct image attachment ID is passed.
* similiar to core function wp_get_attachment_image() but for all the images.
* Biggest adventage is one db query for all intermediate_image_sizes
*
* @param int $post_id Attachment ID.
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="button-default-container">
<a href="http://www.goodbite.nl" target="_blank">Bekijk recept</a>
</td>
</tr>
</table>
@Robbertdk
Robbertdk / @goodbite - nieuwsbrief - Uitgelichte button
Last active August 29, 2015 14:06
gecentreerd, met groene achtergrond
<center>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="middle" class="center button-primary-container center" mc:edit="featured_content_cat">
<a href="http://www.goodbite.nl" target="_blank">bekijk de burger</a>
</td>
</tr>
</table>
</center>
@Robbertdk
Robbertdk / markdown-dummy
Last active April 17, 2024 19:53
Markdown dummy content. Dummy content for the most used HTML text elements. Useful for a thorough design of a text
# One morning, when Gregor Samsa woke from troubled dreams.
One morning, when Gregor Samsa woke from troubled dreams, he found himself *transformed* in his bed into a horrible [vermin](http://en.wikipedia.org/wiki/Vermin "Wikipedia Vermin"). He lay on his armour-like back, and if he lifted his head a little he could see his brown belly, slightly domed and divided by arches into stiff sections. The bedding was hardly able to cover **strong** it and seemed ready to slide off any moment. His many legs, pitifully thin compared with the size of the rest of him, link waved abouthelplessly as he looked. <cite>“What's happened to me?”</cite> he thought. It wasn't a dream. His room, a proper human room although a little too small, lay peacefully between its four familiar walls.</p>
## The bedding was hardly able to cover it.
It showed a lady fitted out with a fur hat and fur boa who sat upright, raising a heavy fur muff that covered the whole of her lower arm towards the viewer a solid fur muff into which her entir
@Robbertdk
Robbertdk / Custom jQuery Validate
Last active November 25, 2015 13:52
Custom jQuery Validate methods
/*
* Custom method to make a yes no radio box only validate on yes
*/
addSelectiveRadioMethod: function(){
jQuery.validator.addMethod("requiredRadioValue", function(value, element, params) {
var selectedValue = $('input:radio[name=' + element.name + ']:checked').val();
return selectedValue === params;
}, "You must select the required option.");
},
@Robbertdk
Robbertdk / Vertical Orbit Slider.markdown
Created December 9, 2015 10:47
Vertical Orbit Slider
@Robbertdk
Robbertdk / Google-analytics-wp-themes.php
Last active January 18, 2016 10:08
Google Analytics include in Wordpress themes functions.php
function my_theme_google_analytics() { ?>
<script>
(function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]=
function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date;
e=o.createElement(i);r=o.getElementsByTagName(i)[0];
e.src='//www.google-analytics.com/analytics.js';
r.parentNode.insertBefore(e,r)}(window,document,'script','ga'));
ga('create','GOOGLE ANALYTICS ID');ga('send','pageview');
</script>
<?php }