Skip to content

Instantly share code, notes, and snippets.

@kovshenin
kovshenin / page-parent.php
Created January 8, 2014 09:19
Append a link to the page parent at the end of the content when on children pages.
<?php
/**
* Plugin Name: Page Parent Link
*/
function my_the_content( $content ) {
$post = get_post();
if ( 'page' == $post->post_type && $post->post_parent > 0 ) {
$parent = new WP_Query( array(
'post_type' => 'page',
'post__in' => array( $post->post_parent ),
<?php
add_filter( 'pl_opt-textbox_title', 'hack_title' );
function hack_title( $opt ) {
global $post;
if( 4125 == $post->ID )
return 'Hello World!';
else
return $opt;
}
@Pross
Pross / Fix Icons
Last active August 29, 2015 13:56
jQuery( "i" ).each(function( e ) {
var classes = jQuery(this).attr('class') || ''
var check = classes.indexOf("icon-");
if( -1 != check ) {
jQuery(this).attr('class', 'icon ' + classes)
}
})
<?php
class Section_Overide {
function __construct() {
add_filter( 'pagelines_render_section', array( $this, 'section_overide' ), 10, 2 );
}
function section_overide( $s, $class ) {
@Pross
Pross / functions.php
Created April 4, 2014 22:46
Remove thumbnail from single posts
<?php
function remove_post_thumbnail($metadata, $object_id, $meta_key, $single){
if( isset($meta_key) && '_thumbnail_id' === $meta_key && is_single() )
return false;
else
return $metadata;
}
add_filter('get_post_metadata', 'remove_post_thumbnail', true, 4);
@cliffordp
cliffordp / dms-makestuffinsidefullwidth.less
Created April 24, 2014 18:43
Change content-width sections inside a DMS Canvas Area to full-width -- http://www.pagelinestheme.com/make-content-width-section-full-width/
// from http://www.pagelinestheme.com/make-content-width-section-full-width/
// overriding dms/dms/less/pl-structure.less
body.display-boxed #site .boxed-wrap .pl-area.makestuffinsidefullwidth .pl-area-wrap > .pl-content {
padding-left: 0px;
padding-right: 0px;
}
body.display-full #site .pl-area.makestuffinsidefullwidth .pl-content {
max-width: none;
}
<?php
// filter the Gravity Forms button type
add_filter("gform_submit_button_1", "form_submit_button", 10, 2);
function form_submit_button($button, $form){
return "<button class='button' id='gform_submit_button_{$form["id"]}'><span><i class='fa fa-share fa-2x'></i> Send </span></button>";
}
//Change hook of gform_submit_button_X to the form that you are using
//Change <span><i class='fa fa-share fa-2x'></i> Send </span> to Font awesome and text of your choice
<?php
/*
* NOTE: 2 varibales passed here...
*/
add_filter( 'pl-area-inner-classes', 'my_classes_filter', 10, 2 );
/*
* Filter function now needs 2 variables
* 1st is the actual value being filtered
* 2nd is the section meta data in the form of an array.
@mathetos
mathetos / gist:6c4d3dc77ee3591e0a74
Created July 22, 2014 04:45
Admin Enqueue Iris.js
<?php
function load_mc_iris() {
if (wp_script_is( 'iris', 'enqueued' )) {
return; // if it's already enqueued, don't enqueue it again.
} else { // since it's NOT enqueued, let's enqueue it
wp_enqueue_script(
'iris', //iris.js handle
admin_url( 'js/iris.min.js' ), //path to wordpress iris file
@Pross
Pross / functions.php
Created July 30, 2014 19:42
Add ACF support for DMS2
<?php
add_filter('acf/location/rule_types', 'acf_location_rules_types');
function acf_location_rules_types( $choices ) {
$choices['Page']['pagelinespage'] = 'Pagelines Page';
return $choices;
}
// Find pages
add_filter('acf/location/rule_values/pagelinespage', 'acf_location_rules_values_pagelinespage');