This code how to replace the traditional radio-buttons, for custom images. You can do the same with checkboxes.
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 jk_move_textarea( $input = array () ) { | |
static $textarea = ''; | |
if ( 'comment_form_defaults' === current_filter() ) { | |
$textarea = $input['comment_field']; | |
$input['comment_field'] = ''; | |
return $input; | |
} | |
if ( is_singular( 'post' ) || is_page() ) { | |
print $textarea; |
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 | |
if (!class_exists('GFCPTAddonBase')) { | |
/* | |
* Base class for the GFCPT Addon. All common code is in here and differences per version are overrided | |
*/ | |
class GFCPTAddonBase { | |
protected $_has_tag_inputs = false; |
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
/* Regular jQuery */ | |
$('.hideable').on('click', function() { | |
$(this).hide(); | |
}) | |
/* Compatibility Mode */ | |
jQuery('.hideable').on('click', function() { | |
jQuery(this).hide(); | |
}) |
This gist assumes:
- you have a local git repo
- with an online remote repository (github / bitbucket etc)
- and a cloud server (Rackspace cloud / Amazon EC2 etc)
- your (PHP) scripts are served from /var/www/html/
- your webpages are executed by apache
- apache's home directory is /var/www/
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 | |
/* | |
Plugin Name: Custom Registration | |
Description: Updates user rating based on number of posts. | |
Version: 1.1 | |
Author: Tristan Slater w/ Agbonghama Collins | |
Author URI: http://kanso.ca | |
*/ |
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
// Usage: | |
// get_id_by_slug('any-page-slug','any-post-type'); | |
function get_id_by_slug($page_slug, $slug_page_type = 'page') { | |
$find_page = get_page_by_path($page_slug, OBJECT, $slug_page_type); | |
if ($find_page) { | |
return $find_page->ID; | |
} else { | |
return null; | |
} |
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 | |
/*========================================= | |
Custom Submit Box | |
==========================================*/ | |
/** | |
* Loop throught custom post types and | |
* replace default submit box | |
* | |
* @since 1.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
<?php | |
/** | |
* Update Post Title from an ACF field value on post save. | |
* | |
* Triggers on save, edit or update of published posts. | |
* Works in "Quick Edit", but not bulk edit. | |
*/ | |
function sync_acf_post_title($post_id, $post, $update) { | |
$acf_title = get_field('my_acf_field_name', $post_id); // NOTE: enter the name of the ACF field here |
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
// inspired by: https://gist.github.com/rveitch/9018669face1686e74aaa68026856f36 | |
// add iitle to CPTs which doesn't provide a title (useful for the relationship field (https://www.advancedcustomfields.com/resources/relationship/)) | |
function sync_acf_post_title($post_id, $post, $update) { | |
$post_type = get_post_type($post_id); | |
// check for the current CPT | |
if($post_type === "cpt_name_1") { | |
OlderNewer