Skip to content

Instantly share code, notes, and snippets.

Simon Prosser Pross

Block or report user

Report or block Pross

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View function.php
function high_priority_style() {
printf( "<link rel='stylesheet' id='important-css' href='%s' type='text/css' media='all' />\n", get_stylesheet_directory_uri() . '/wp-pohja-codekit/codekit.css' );
}
add_action('wp_head', 'high_priority_style', 8);
View functions.php
<?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.
View functions.php
<?php // only add this if there isnt one already, its only here to make highlighting work
add_filter( 'pless_vars', 'make_cdn_vars' );
function make_cdn_vars( $vars ) {
$vars['plSectionsRoot'] = str_replace( 'www', 'cdn', $vars['plSectionsRoot'] );
$vars['plRoot'] = str_replace( 'www', 'cdn', $vars['plRoot'] );
$vars['plCrossRoot'] = str_replace( 'www', 'cdn', $vars['plCrossRoot'] );
return $vars;
}
@Pross
Pross / functions.php
Created Jun 19, 2014
nav_logo filter
View functions.php
<?php
// we are going to filter navbar_logo section option on the fly..
add_filter( 'pl_opt-navbar_logo', 'change_logo_on_lang' );
function change_logo_on_lang( $val ) { // $val is the value of the setting.
// use some polylang data to get current language
global $curlang;
$curlang = $this->curlang->slug;
// asumming the slug is nl or en
@Pross
Pross / functions.php
Created Jun 19, 2014
Add a class to passworded post
View functions.php
<?php
add_filter( 'body_class', 'add_password_class' );
function password_class( $classes ) {
if( post_password_required() ) {
$classes[] = 'password-required';
}
return $classes;
}
View functions.php
<?php
add_filter( 'the_excerpt', 'maybe_get_the_content' );
function maybe_get_the_content( $content ) {
global $wp_query;
if( $wp_query->is_home )
return get_the_content();
else
return $content;
}
View spam.sh
#!/bin/bash
echo "" > spam.txt
for url in $(wp site list --field=url)
do
for id in $(wp --url=$url post list --field=ID)
do
printf ":"
content=$(wp --url=$url post get $id --field=content)
if [[ $content =~ .*viagra.* ]]
@Pross
Pross / some.html
Created Jul 21, 2014
Disable animation on mobiles.
View some.html
<script>
jQuery( document ).ready(function() {
var width = jQuery(window).width()
if( width < 480 )
jQuery('div').removeClass('pl-animation')
});
</script>
View script.html
<script>
jQuery( document ).ready(function() {
jQuery('.ibox-link a').html( 'Mer <i class="icon icon-angle-right"></i>' )
})
</script>
View functions.php
<?php
add_action( 'after_setup_theme', 'my_add_filter' );
function my_add_filter() {
add_filter( 'pless_vars', 'my_pless_vars' );
}
function my_pless_vars( $vars ){
$vars['plBaseFont'] = '"ff-tisa-web-pro",georgia,serif;';
return $vars;
You can’t perform that action at this time.