Skip to content

Instantly share code, notes, and snippets.

View vanderwijk's full-sized avatar

Johan van der Wijk vanderwijk

View GitHub Profile
@vanderwijk
vanderwijk / mx_hide_from_list_pages.php
Created October 24, 2012 13:37
Exclude pages from wp_list_pages
function mx_hide_from_list_pages( $exclude_array ) {
global $wpdb;
$table = _get_meta_table('post');
$sql = "SELECT post_id FROM " . $table . " WHERE meta_key ='_smartmeta_navigation_hide' AND meta_value ='true'";
$id_array = $wpdb->get_col($sql);
$exclude_array = array_merge($id_array, $exclude_array);
return $exclude_array;
}
add_filter( 'wp_list_pages_excludes', 'mx_hide_from_list_pages' );
add_smart_meta_box('page_options_meta_box', array(
'title' => 'Page Options',
'pages' => array('page'),
'context' => 'normal',
'priority' => 'default',
'fields' => array(
array(
'name' => 'Slider',
'id' => 'show_slider',
'default' => 'false',
<script type="text/javascript" src="http://emarketing.vanderwijk.nl/t/y/p/adrhi/-1/0/0/1/0/"></script>
@vanderwijk
vanderwijk / shortcode-template.php
Created March 10, 2021 09:32
Custom template example for shortcodes
<?php
function shortcode_template( $this_post ) {
try {
if ( has_post_thumbnail( $this_post->ID ) ) {
$thumb_id = get_post_thumbnail_id($this_post->ID);
$thumb_url = wp_get_attachment_image_src($thumb_id,'full', false);
$style = 'background-image: url('. $thumb_url[0] .')';
}
@vanderwijk
vanderwijk / custom-post-widget.php
Created March 10, 2021 09:33
Custom template example for widgets
<?php
if ( !$apply_content_filters ) { // Don't apply the content filter if checkbox selected
$content = apply_filters( 'the_content', $content);
}
echo $before_widget;
if ( $show_custom_post_title ) {
echo $before_title;
echo apply_filters( 'widget_title',$content_post->post_title);
if ( $show_featured_image ) {
echo get_the_post_thumbnail( $content_post -> ID );
@vanderwijk
vanderwijk / gist:53065eab6f294d82a7fab6b73bcf5c9f
Created December 23, 2021 13:16
Gravity forms Mollie payment status shortcode
function mollie_payment_status() {
if ( isset($_GET['entry_id']) ) {
$entry_id = $_GET['entry_id'];
$entry = GFAPI::get_entry( $entry_id );
//print_r ($entry);
$payment_status = rgar( $entry, 'payment_status' );
if ( $payment_status == 'Paid' ) {
return '<p>Bedankt voor uw aanmelding. Uw betaling is voltooid en u ontvangt spoedig een bevestigingsmail.</p>';
} else if ( $payment_status == 'Failed' ) {
return '<p>Uw betaling is mislukt. Probeert u het nogmaals of neem contact met ons op voor assistentie.</p>';
@vanderwijk
vanderwijk / calendly-inline-widget.js
Created June 17, 2022 09:53
Pass UTM parameters to Calendly
<div class="calendly-inline-widget" id="calendly-inline-widget" style="min-width:320px;height:820px;" data-auto-load="false"></div>
<script src="https://assets.calendly.com/assets/external/widget.js"></script>
<script>
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const utm_source = urlParams.get('utm_source');
const utm_medium = urlParams.get('utm_medium');
const utm_campaign = urlParams.get('utm_campaign');