Skip to content

Instantly share code, notes, and snippets.

View rafsuntaskin's full-sized avatar
🎯
Focusing

Rafsun Chowdhury rafsuntaskin

🎯
Focusing
View GitHub Profile
@rafsuntaskin
rafsuntaskin / plugin.php
Created October 22, 2018 10:23
Add WP plugin action link
add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'plugin_action_links' );
function plugin_action_links( $links ) {
$links[] = '<a href="' . admin_url( 'admin.php?page=my-plugin-settings' ) . '">' . __( 'Settings', 'text-domain' ) . '</a>';
return $links;
}
@rafsuntaskin
rafsuntaskin / feature-hook.php
Last active December 21, 2018 19:12
The Events Calendar - Dynamic event featuring
<?php
add_action( 'tribe_events_update_meta', 'rt_mt_make_featured_event', 10, 3 );
function rt_mt_make_featured_event( $event_id, $data, $event ) {
//if venue is Dhaka, mark as featured
if ( $data['Venue']['City'][0] == 'Dhaka' ) {
tribe( 'tec.featured_events' )->feature( $event_id );
//if you want to unfeature use this instead
@rafsuntaskin
rafsuntaskin / functions.php
Created December 21, 2018 20:54
Evens Calendar - Month view default tooltip
<?php
add_filter( 'tribe_events_template_data_array', 'rt_mt_month_view_default_image', 10, 3 );
function rt_mt_month_view_default_image( $json, $event, $additional ) {
// if featured images is empty
if ( empty( $json['imageTooltipSrc'] ) ) {
$json['imageTooltipSrc'] = "YOUR_IMAGE_LINK";
}
@rafsuntaskin
rafsuntaskin / functions.php
Created December 21, 2018 21:22
Events Calendar Buy button change
<?php
add_filter( 'tribe_tickets_buy_button', 'rt_mt_buy_now_rename', 10, 4 );
function rt_mt_buy_now_rename( $html, $parts, $types, $event_id) {
$find = 'Buy Now!';
$replace = 'Register';
$html['button'] = str_replace( $find, $replace, $html['button'] );
@rafsuntaskin
rafsuntaskin / single-event.php
Created December 21, 2018 21:55
Single event with time
<?php
/**
* Month Single Event
* This file contains one event in the month view
*
* Override this template in your own theme by creating a file at [your-theme]/tribe-events/month/single-event.php
*
* @package TribeEventsCalendar
* @version 4.6.21
*
@rafsuntaskin
rafsuntaskin / functions.php
Created December 21, 2018 23:36
Replace text label
<?php
add_filter( 'gettext_with_context', 'rt_mt_change_ticket_label', 99, 3 );
add_filter( 'gettext', 'rt_mt_change_ticket_label', 99, 3 );
function rt_mt_change_ticket_label( $translated_text, $untranslated_text, $domain ) {
$replace_pairs = array(
'Tickets' => 'Entries',
'Ticket' => 'Entry',
'Ticketed' => 'Entered',
@rafsuntaskin
rafsuntaskin / disable_recurring_community_events.php
Last active February 8, 2019 20:26 — forked from ckpicker/gist:7682707
Community Events 3.2 // Hide recurrence on the submission form
add_action( 'wp_head', 'community_add_css' );
function community_add_css() {
if (tribe_is_community_edit_event_page() || tribe_is_community_my_events_page()) {
?>
<style>
.recurrence-row {display:none !important;}
</style>
<?php
}
}
@rafsuntaskin
rafsuntaskin / debug-ep.php
Created February 26, 2019 16:35 — forked from sc0ttkclark/debug-ep.php
ElasticPress debugging code for mu-plugins
<?php
/**
* @param string $type
*
* @return bool
*/
function debug_ep_is_debug( $type = 'normal' ) {
if ( ! empty( $_GET['epdebug'] ) || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
@rafsuntaskin
rafsuntaskin / category_sync.php
Last active March 31, 2020 20:54
Event Tickets Category Sync Tag Sync with WooCommerce product category and tag
<?php
/**
* Description: Sync Event Tickets tag and category with WooCommerce product category and tag - depends on the slug
* Usage: Copy the snippet into your child theme's functions.php file.
* Change delimiter as per your needs.
* Make sure that the slug is same for both tag or both category to sync properly
*
* Plugins: Event Tickets
@rafsuntaskin
rafsuntaskin / functions.php
Last active May 22, 2019 11:01
Woo Empty cart return to Events Calendar
<?php
/**
* WooCommerce alter Shop redirect from cart to Events Calendar
*
* @author Rafsun Chowdhury
*
* @link https://gist.github.com/rafsuntaskin/2e88444a507e7301615c568d5504f828
*