This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
/** | |
* Truncates text. | |
* | |
* Cuts a string to the length of $length and replaces the last characters | |
* with the ending if the text is longer than length. | |
* | |
* See: oikos.org.uk/2013/02/tech-notes-a-wordpress-excerpt-with-html-tags/ | |
* See also: wpengineer.com/2410/dont-use-strlen/ | |
* See also also: oikos.org.uk/2013/02/tech-notes-a-wordpress-excerpt-with-html-tags/#comment-1467093876 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(class_exists( 'Super_Custom_Post_Type' )){ | |
add_action( 'after_setup_theme','trusted_page_sup' ); | |
function trusted_page_sup() { | |
if ( isset( $_GET['post'] ) ) | |
$post_id = $_GET['post']; | |
elseif ( isset( $_POST['post_ID'] ) ) | |
$post_id = $_POST['post_ID']; | |
else | |
$post_id = get_the_ID(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function get_widget_instance( $widget_id ) { | |
global $wp_registered_widgets; | |
if ( empty( $wp_registered_widgets[$widget_id]['callback'] ) ) | |
return array(); | |
/** @var WP_Widget $widget */ | |
$widget = $wp_registered_widgets[$widget_id]['callback'][0]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Download Elementary OS from here: | |
#http://sourceforge.net/projects/elementaryos/files/stable/ | |
#First you update your system | |
sudo apt-get update && sudo apt-get dist-upgrade | |
#Install Google Chrome | |
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - | |
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
@link https://bavotasan.com/2015/eliminate-thumbnails-custom-post-types/ | |
add_filter( 'intermediate_image_sizes', rma_custom_intermediate_image_sizes, 999 ); | |
function rma_custom_intermediate_image_sizes( $image_sizes ){ | |
return array(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($) { | |
$doc = $(document); | |
$doc.ready( function() { | |
/** | |
* Retrieve posts | |
*/ | |
function get_posts($params) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* AJAC filter posts by taxonomy term | |
*/ | |
function vb_filter_posts_mt() { | |
if( !isset( $_POST['nonce'] ) || !wp_verify_nonce( $_POST['nonce'], 'bobz' ) ) | |
die('Permission denied'); | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// join term_relationships and term_taxonomy | |
add_filter( 'getarchives_join', 'customarchives_join' ); | |
// add where condition for category | |
add_filter( 'getarchives_where', 'customarchives_where' ); | |
// add where condition for date | |
add_filter('getarchives_where','filter_until_year_archives'); | |
function customarchives_join($join_clause) { | |
global $wpdb; | |
return $join_clause." INNER JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// "{0} is dead, but {1} is alive! {0} {2}".format("ASP", "ASP.NET") | |
if (!String.prototype.format) { | |
String.prototype.format = function() { | |
var args = arguments; | |
return this.replace(/{(\d+)}/g, function(match, number) { | |
return typeof args[number] != 'undefined' | |
? args[number] | |
: match | |
; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This file adds the SearchWP Images template to your theme. | |
* | |
* Template Name: SearchWP Images | |
* | |
* @author Robert Neu | |
* @package Genesis | |
* @subpackage SearchWP | |
*/ |
OlderNewer