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
//With the help of this existing code block inside the plugin https://github.com/TablePress/TablePress/blob/ea2ecc02d3b69925b7322dd195f1a32898b59c38/classes/class-import.php#L375-L382 | |
<?php | |
function column_table_last_modified() { | |
$existing_tables = array(); | |
// Load all table IDs and names for a comparison with the file name. | |
$table_ids = TablePress::$model_table->load_all( false ); | |
foreach ( $table_ids as $table_id ) { | |
// Load table, without table data, options, and visibility settings. | |
$table = TablePress::$model_table->load( $table_id, false, 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 | |
function wooc_extra_register_fields() {?> | |
<p class="form-row form-row-first"> | |
<label for="reg_billing_first_name"><?php _e( 'First name', 'woocommerce' ); ?><span class="required">*</span></label> | |
<input type="text" class="input-text" name="billing_first_name" id="reg_billing_first_name" value="<?php if ( ! empty( $_POST['billing_first_name'] ) ) esc_attr_e( $_POST['billing_first_name'] ); ?>" /> | |
</p> |
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
<script> | |
jQuery(function($){ | |
$( document ).on( 'elementor/popup/show', (event, id, instance) => { | |
if ( id === 2063 ) { | |
setTimeout(function(){ | |
if($('#elementor-popup-modal-'+id+' .gform_wrapper').length){ | |
var formID = $('#elementor-popup-modal-'+id+' .gform_wrapper form').attr('data-formid'); | |
console.log('gfrom found'); | |
$('form[id^="gform_'+formID+'"]').on('change', function (e) { | |
var getCurrentPage = $('#gform_source_page_number_'+formID+'').val(); |
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 | |
//Creating a new column in Experience term table to show term ID | |
add_filter( 'manage_edit-experience_columns', 'wpdocs_add_new_genre_columns' ); | |
add_filter( 'manage_edit-destination_columns', 'wpdocs_add_new_genre_columns' ); | |
function wpdocs_add_new_genre_columns( $columns ) { | |
$columns['catID'] = __( 'Term ID' ); | |
return $columns; | |
} |
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
//Just repeat this add_action hook available for the ACF plugin | |
//add_action('acf/render_field_settings/type=text', 'add_readonly_and_disabled_to_text_field'); | |
//for the other types of fields be just changing the value of the type in the hook "/type=text". | |
//e.g. add_action('acf/render_field_settings/type=textarea', 'add_readonly_and_disabled_to_text_field'); | |
//It will add 2 radio option read-only and disable the field for the textarea field. | |
<?php | |
add_action('acf/render_field_settings/type=textarea', 'add_readonly_and_disabled_to_text_field'); | |
add_action('acf/render_field_settings/type=text', 'add_readonly_and_disabled_to_text_field'); |
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
//Create 2 custom meta field with the names: 'wpb_post_views_count' and 'user_ip'. | |
<?php | |
function wpb_set_post_views($postID) { | |
$user_ip = $_SERVER['REMOTE_ADDR']; //retrieve the current IP address of the visitor | |
$key = $user_ip . 'x' . $postID; //combine post ID & IP to form unique key | |
$value = array($user_ip, $postID); // store post ID & IP as separate values (see note) | |
$visited = get_transient($key); //get transient and store in variable | |
//check to see if the Post ID/IP ($key) address is currently stored as a transient | |
if ( false === ( $visited ) ) { |
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
<!-- We will not do anything to change the detfault publishe date --> | |
<!-- We will use the publishe date to create a date 2days prior of the publishe date using a custom date time field. --> | |
<!-- Create a date-time custom field using ACF plugin for your CPT or any kind of post type --> | |
<!-- Use this function in your theme's functions.php and use the custom field's meta name to fire the update query --> | |
<!-- Also you can change the prior day or post day by just changing "-1 day or +1 day" inside this function --> | |
<?php | |
add_action( 'acf/save_post', 'my_acf_save_post' ); | |
function my_acf_save_post( $post_id ) { | |
//$date = get_the_date( 'Y-m-d H:i:s', $post_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 | |
?> | |
<script src="https://maps.googleapis.com/maps/api/js?key=<?php the_field('gmap_api_key', 'option'); ?>"></script> | |
<style> | |
.acf-map { height: 400px; } | |
p.emails a:not(:last-child)::after { | |
content: ', '; | |
} | |
</style> | |
<?php if( have_rows('address', 'option') ): ?> |
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 | |
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5 );// remoove default star rating from shop listing page | |
//add star rating before shop loop title | |
add_filter( 'woocommerce_before_shop_loop_item_title', 'star_rating' ); | |
function star_rating() { | |
global $product; | |
if ( get_option( 'woocommerce_enable_review_rating' ) === 'no' ) { | |
return; |
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 Product category and number of flavour attribute after shop loop title | |
add_filter( 'woocommerce_after_shop_loop_item_title', 'so58344618_variation_count' ); | |
function so58344618_variation_count() { | |
global $product; | |
$categories = get_the_terms( $post->ID, 'product_cat' ); | |
$catList = ''; | |
foreach($categories as $category) { | |
if(!empty($catList)) { |
NewerOlder