This file contains hidden or 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
global $wp_query; | |
$term = $wp_query->get_queried_object(); | |
$title = $term->taxonomy; | |
//var_dump $term to see all the stuff you can get | |
//if its a tag we want Tag not post_tag.... its the slug... | |
if($title == 'post_tag'){ | |
echo 'Tag'; | |
} | |
else{ | |
echo ucwords( $title); |
This file contains hidden or 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
//put into functions | |
// AJAX receiver function | |
function get_my_ajax_stuff() { | |
// If there's a POST and a nonce set, verify the nonce to make sure this request is coming from the right place | |
if ( $_POST && isset( $_POST['nonce'] ) && wp_verify_nonce( $_POST['nonce'], 'my_nonce_action' ) ) { | |
// Initialize | |
$results = array(); | |
// Do something here to get some data (sanitize user input as needed) | |
$articles = new WP_Query(array( |
This file contains hidden or 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
add_filter( 'gform_validation', 'profile_validation' ); | |
function profile_validation( $validation_result ) { | |
$form = $validation_result['form']; | |
//date of birth | |
$dob = rgpost('input_4'); //set to date field. also set below | |
// this the minimum age requirement we are validating |
This file contains hidden or 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
/*-------------------------------------------------------------- | |
# Gravity forms does not let you map a post image field in a custom field | |
# If you use pods and you would like to be able to map a post image to a pods image field make sure: | |
# the post image is not featured as that would become the post thumbnail | |
# add a css class tot he post image field in the form of of field_pod_field_name ( must start with field_ ) | |
--------------------------------------------------------------*/ | |
add_action( 'gform_after_submission', 'add_pod_images', 10, 2 ); | |
function add_pod_images( $entry, $form ) { |
This file contains hidden or 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
add_action( 'gform_after_create_post', 'gf_add_to_media_library', 10, 3 ); | |
/** | |
* Save file upload fields under custom post field to the library | |
* | |
* @param $post_id The post identifier | |
* @param $entry The entry | |
* @param $form The form | |
*/ |
This file contains hidden or 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 | |
/** | |
* Payment subscriptions and updating billing and cancelling subscriptions takes place with these hooks | |
* We need the stripe customer user id for updating billing | |
* we need the entry id of subscription so we can cancel it. | |
*/ | |
/** | |
* @param $entry |
This file contains hidden or 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 | |
//Working on a WordPress theme with others can be difficult if you want to use the same database, but work locally and use git for the code. | |
//To do this we came up with a solution that allows working with a remote DB that everyone on the team can access, while still developing locally. | |
//First make sure that your wp-config file is set to use the remote db: | |
//set the credentials for the remote DB username and table | |
//change DB host to be the ip of the remote server | |
//Example: |
OlderNewer