Skip to content

Instantly share code, notes, and snippets.

// List Custom Post Types in category and tags archives
add_filter('pre_get_posts', 'query_post_type');
function query_post_type($query) {
if(is_category() || is_tag()) {
$post_type = get_query_var('post_type');
if( ! empty( $post_type ) ){
$post_type = array_merge(array('post','VisualsWshortText', 'longTextWvisuals', 'TxtwAncillaryVisuals'), $post_type );
} else {
$post_type = array('post','VisualsWshortText', 'longTextWvisuals', 'TxtwAncillaryVisuals');
@sareiodata
sareiodata / gist:0d70d54e6167cddd7c44
Last active August 29, 2015 14:06
hide default edit profile fields in the backend
/*
* Hide Default Edit Profile Fields in the backend
*/
function wppb_hide_personal_options(){
?>
<script type="text/javascript">
jQuery(document).ready(function($) {
$('form#your-profile > h3:first').hide();
$('form#your-profile > table:first').hide();
@sareiodata
sareiodata / empty-wp-plugin.php
Created July 2, 2014 08:45
Empty WordPress plugin
<?php
/**
* Plugin Name: Name Of The Plugin
* Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
* Description: A brief description of the Plugin.
* Version: The Plugin's Version Number, e.g.: 1.0
* Author: Name Of The Plugin Author
* Author URI: http://URI_Of_The_Plugin_Author
* License: A "Slug" license name e.g. GPL2
*/
<?php
/*
Plugin Name: WCK - Conditional Shortcode Based on has_term
Plugin URI: http://www.cozmoslabs.com
Description: Gives you access to the [has-term term="term-name" taxonomy="tax-name" value="true" id=""] List this if post has term-name [/has-term] AND [has-term term="term-name" taxonomy="tax-name" value="false" id=""] List this if post doesn't have term-name [/has-term]
Author: Cristian Antohe
Version: 0.1
Author URI: http://www.cozmoslabs.com
*/
@sareiodata
sareiodata / pb_custom_email_on_edit_profile.php
Created May 12, 2014 12:51
Profile Builder Pro - Custom Email on Edit Profile
<?php
/*
Plugin Name: Profile Builder Pro - Custom Email on Edit Profile
Plugin URI: http://www.cozmoslabs.com/wordpress-profile-builder/
Description: Customize the Profile Builder Pro plugin.
Version: 0.1
Author: Reflection Media, Barina Gabriel
Author URI: http://www.cozmoslabs.com
License: GPL2
*/
@sareiodata
sareiodata / sorting-by-date.php
Created April 17, 2014 13:15
Enable Sorting By Date in WCK Swift Templates
<?php
/*
Plugin Name: Enable Sorting By Date
Plugin URI: http://www.cozmoslabs.com
Description: Custom plugin that will enable to sort a Swift Template by a custom date.
Author: Cristian Antohe
Version: 1.0
Author URI: http://www.cozmsolabs.com
*/
add_filter( 'wck-datepicker-args', 'wck_custom_datepicker_js');
@sareiodata
sareiodata / gist:10979872
Created April 17, 2014 12:34
Mustache Conditional Tags
{{#facebook_link}}
<a href="{{facebook_link}}">Facebook Link</a>
{{/facebook_link}}
@sareiodata
sareiodata / gist:10885367
Last active August 29, 2015 13:59
Profile Builder User Listing with user posts
<?php
//////////////////////////////////////////////////////////////////////////////////////////////////
// List user posts on the single user listing
//////////////////////////////////////////////////////////////////////////////////////////////////
add_shortcode( 'wppb-user-posts', 'wppb_custom_list_user_posts' );
function wppb_custom_list_user_posts(){
//get user ID
if (isset($_GET['userID'])){
@sareiodata
sareiodata / gist:10877660
Last active August 29, 2015 13:59
Profile Builder admin only fields
<?php
// don't allow non-admin users to edit this particular custom field
add_action('update_user_metadata', 'wppb_custom_admin_only_field', 10, 5);
function wppb_custom_admin_only_field( $content, $object_id, $meta_key, $meta_value, $prev_value){
// replace custom_field_4 with your own Meta-Key (find it in Profile Builder -> Extra fields)
if ( $meta_key == 'custom_field_4' && !current_user_can( 'manage_options' ) ){
return false;
}
}
Apple&#44; pears&#44; bananas, Mangos&#44; pinneapple&#44; guava