Skip to content

Instantly share code, notes, and snippets.

Mark Wilkinson wpmark

Block or report user

Report or block wpmark

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
@wpmark
wpmark / cpt-archive-show-all-posts.php
Last active Jun 8, 2018
Pre Get Posts to Show All Posts for Custom Post Type Archive
View cpt-archive-show-all-posts.php
<?php
function wpmark_alter_team_archive_template_query( $query ) {
/* only proceed on the front end */
if( is_admin() ) {
return;
}
/* only on the person post archive for the main query */
if ( $query->is_post_type_archive( 'wpmark_person' ) && $query->is_main_query() ) {
@wpmark
wpmark / cpt-archive-orderby-term.php
Last active Aug 29, 2015
Custom Post Type Archive Posts Ordered by Term
View cpt-archive-orderby-term.php
<?php
/* get our array of post ids in term order */
$people = wpmark_get_posts_in_terms_array(
array(
'orderby' => 'id',
'taxonomy' => 'sdance_person_type',
'posts' => $wp_query->posts
)
);
@wpmark
wpmark / register-shortcode-with-ui.php
Created May 6, 2015
Register Shortcode with Shortcode UI
View register-shortcode-with-ui.php
<?php
/**
* function wpmark_register_before_after_shortcake()
*/
function wpmark_register_before_after_shortcake() {
shortcode_ui_register_for_shortcode(
'before_after_image', // name of shortcode ui
@wpmark
wpmark / before-after-shortcode-jquery
Created May 6, 2015
Before and After Shortcode jQuery
View before-after-shortcode-jquery
/**
* trigger the before and after images
*/
var beforeafter = function() {
/* get the preceeding element before the toggle button - hides all the after images */
$( '.before-after-toggle' ).prev().hide();
/* when the element with 'before-after-toggle' class is clicked */
$( '.before-after-toggle' ).click(function() {
@wpmark
wpmark / before-after-shortcode.php
Created May 6, 2015
Before and After Image Shortcode
View before-after-shortcode.php
<?php
/**
* function wpmark_add_before_after_shortcode()
* adds the shortcode to output the before and after image
*/
function wpmark_add_before_after_shortcode( $attr ) {
$attr = wp_parse_args(
$attr,
array(
@wpmark
wpmark / wp-dashboard-tabs.php
Created Mar 18, 2015
WordPress Dashboard Tabs
View wp-dashboard-tabs.php
<?php
/***************************************************************
* Function wpbasis_dashboard_content()
* Pulls in the new dashboard page content from plugin file
***************************************************************/
function wpbasis_dashboard() {
/* check for a dashboard content file in the theme folder */
if( file_exists( STYLESHEETPATH . '/wpbasis/dashboard.php' ) ) {
/* load the dashboard content file from the theme folder */
get_template_part( 'wpbasis/dashboard', 'content' );
@wpmark
wpmark / wp_terms_query.php
Created Jan 21, 2015
Query Posts from Different Terms
View wp_terms_query.php
<?php
/* get the terms for the taxonomy */
$terms = get_terms(
'taxonomy_name_here',
array(
'hide_empty' => false
)
);
@wpmark
wpmark / add-options-with-of-options.php
Created Jan 6, 2015
Add options with the of_options Options Framework Filter
View add-options-with-of-options.php
/**
* function spts_site_options()
* sets the options which appear on the theme options page under
* appearance in the dashboard.
* for a detailed list of all the example options that can be used here see
* https://github.com/devinsays/options-framework-plugin/blob/master/options-check/options.php
* @param (array) $options an array of options to filter
* @filtered $of_options
* @return (array) $options to new array of options to use
*/
View options-framework-get-option.php
<?php
/**
* function wpmark_get_option()
* gets a theme options specificed from the options table
* @param (string) $name is the name of the options to get
* @param (string) $default is the default value to return if no value is present
*/
function wpmark_get_option( $name, $default = false ) {
/* get the options framework setting option */
@wpmark
wpmark / optionsframework_option_name.php
Created Jan 6, 2015
Overwrite the optionsframework_option_name function
View optionsframework_option_name.php
<?php
/**
* function optionsframework_option_name()
*
* overwrites the function in the options framework which
* names the options value that stores all the options
*/
function optionsframework_option_name() {
/* get the options framework setting from options */
You can’t perform that action at this time.