Vendor & Venue Posts: Sync Target Market Fields with Location Taxonomy

// Gravity Forms hook for form 5 (vendor) add_action(‘gform_after_submission_5’, function ($entry, $form) { $post_id = rgar($entry, ‘1’); if (!$post_id || get_post_type($post_id) !== ‘vendor’) return; // Check if the required meta fields exist if (!get_post_meta($post_id, ‘target_market_1_city’, true)) return; // Update taxonomy…Continue reading

Preload First Post Image

function preload_first_content_image() { if (is_single()) { $post = get_post(); if ($post) { // Get post content $content = $post->post_content; // Find first image in the content preg_match_all(‘//i’, $content, $matches); if (!empty($matches[1])) { $first_image = $matches[1][0]; echo ‘‘; } } }…Continue reading

WordPress Post Views Counter Function

function wpb_set_post_views($postID) { $count_key = ‘wpb_post_views_count’; $count = get_post_meta($postID, $count_key, true); if($count==”){ $count = 0; delete_post_meta($postID, $count_key); add_post_meta($postID, $count_key, ‘0’); }else{ $count++; update_post_meta($postID, $count_key, $count); } } //Get rid of prefetching to keep the count accurate remove_action( ‘wp_head’, ‘adjacent_posts_rel_link_wp_head’, 10,…Continue reading

Completely Disable Comments (copy) (copy)

add_action(‘admin_init’, function () { // Redirect any user trying to access comments page global $pagenow; if ($pagenow === ‘edit-comments.php’) { wp_safe_redirect(admin_url()); exit; } // Remove comments metabox from dashboard remove_meta_box(‘dashboard_recent_comments’, ‘dashboard’, ‘normal’); // Disable support for comments and trackbacks in…Continue reading

Completely Disable Comments (copy)

add_action(‘admin_init’, function () { // Redirect any user trying to access comments page global $pagenow; if ($pagenow === ‘edit-comments.php’) { wp_safe_redirect(admin_url()); exit; } // Remove comments metabox from dashboard remove_meta_box(‘dashboard_recent_comments’, ‘dashboard’, ‘normal’); // Disable support for comments and trackbacks in…Continue reading

Duplicate Post/Page Link (copy)

// Add duplicate button to post/page list of actions. add_filter( ‘post_row_actions’, ‘wpcode_snippet_duplicate_post_link’, 10, 2 ); add_filter( ‘page_row_actions’, ‘wpcode_snippet_duplicate_post_link’, 10, 2 ); // Let’s make sure the function doesn’t already exist. if ( ! function_exists( ‘wpcode_snippet_duplicate_post_link’ ) ) { /** *…Continue reading

Subscription Management (Testing)

// Save Stripe Customer ID to user meta upon user registration add_action( ‘gform_after_submission’, function ( $entry, $form ) { $form_ids = array(3,4,12); if ( ! in_array( (int)$form[‘id’], $form_ids, true ) ) { return; } // Retrieve the Stripe Customer ID…Continue reading

Transform Page Admin To Sales Pages Admin

################################# # Page Edit View ################################# function add_page_meta_boxes() { add_meta_box( ‘page_type_meta_box’, __(‘Page Settings’), ‘render_page_meta_boxes’, ‘page’, ‘side’, ‘high’ // Ensures the meta box appears first ); } add_action(‘add_meta_boxes’, ‘add_page_meta_boxes’); // Render the Meta Box function render_page_meta_boxes($post) { // Get existing values…Continue reading

Remove Author Column from Pages Admin

function remove_author_column_from_pages($columns) { if (isset($columns[‘author’])) { unset($columns[‘author’]); // Remove the “Author” column } return $columns; } add_filter(‘manage_page_posts_columns’, ‘remove_author_column_from_pages’);Continue reading