85 lines
2.8 KiB
PHP
85 lines
2.8 KiB
PHP
<?php
|
|
/**
|
|
* Payfrit Theme Functions
|
|
*/
|
|
|
|
// Theme setup
|
|
function payfrit_setup() {
|
|
add_theme_support('title-tag');
|
|
add_theme_support('post-thumbnails');
|
|
add_theme_support('html5', array('search-form', 'comment-form', 'comment-list', 'gallery', 'caption'));
|
|
|
|
register_nav_menus(array(
|
|
'primary' => __('Primary Menu', 'payfrit'),
|
|
'footer' => __('Footer Menu', 'payfrit'),
|
|
));
|
|
}
|
|
add_action('after_setup_theme', 'payfrit_setup');
|
|
|
|
// Enqueue styles
|
|
function payfrit_scripts() {
|
|
wp_enqueue_style('payfrit-style', get_stylesheet_uri(), array(), '1.0');
|
|
}
|
|
add_action('wp_enqueue_scripts', 'payfrit_scripts');
|
|
|
|
// Remove WordPress junk from head
|
|
remove_action('wp_head', 'wp_generator');
|
|
remove_action('wp_head', 'wlwmanifest_link');
|
|
remove_action('wp_head', 'rsd_link');
|
|
remove_action('wp_head', 'wp_shortlink_wp_head');
|
|
remove_action('wp_head', 'rest_output_link_wp_head');
|
|
remove_action('wp_head', 'wp_oembed_add_discovery_links');
|
|
remove_action('wp_head', 'print_emoji_detection_script', 7);
|
|
remove_action('wp_print_styles', 'print_emoji_styles');
|
|
|
|
// Disable Gutenberg for pages (we're using custom templates)
|
|
function payfrit_disable_gutenberg($current_status, $post_type) {
|
|
if ($post_type === 'page') return false;
|
|
return $current_status;
|
|
}
|
|
add_filter('use_block_editor_for_post_type', 'payfrit_disable_gutenberg', 10, 2);
|
|
|
|
// Custom image sizes
|
|
add_image_size('hero', 1920, 1080, true);
|
|
add_image_size('feature', 800, 600, true);
|
|
|
|
// Theme options - CTA URLs
|
|
function payfrit_get_option($key) {
|
|
$options = array(
|
|
'signup_url' => 'https://biz.payfrit.com/portal/index.html',
|
|
'login_url' => 'https://biz.payfrit.com/portal/index.html',
|
|
'venues_email' => 'venues@payfrit.com',
|
|
);
|
|
return isset($options[$key]) ? $options[$key] : '';
|
|
}
|
|
|
|
// Helper function for theme images
|
|
function payfrit_image($name, $alt = '') {
|
|
$uri = get_template_directory_uri();
|
|
|
|
// Map image names to their extensions
|
|
$images = array(
|
|
'hero' => 'png',
|
|
'kds' => 'png',
|
|
'crowd' => 'png',
|
|
'diners-phone' => 'jpg',
|
|
'diners-table' => 'jpg',
|
|
'venue-kds' => 'jpg',
|
|
);
|
|
|
|
$ext = isset($images[$name]) ? $images[$name] : 'jpg';
|
|
return sprintf('<img src="%s/images/%s.%s" alt="%s">', $uri, esc_attr($name), $ext, esc_attr($alt));
|
|
}
|
|
|
|
// Helper function for CTA buttons
|
|
function payfrit_cta_button($type = 'signup', $class = 'btn btn-primary', $text = 'Create account') {
|
|
$url = payfrit_get_option('signup_url');
|
|
|
|
if ($type === 'login') {
|
|
$url = payfrit_get_option('login_url');
|
|
} elseif ($type === 'venues') {
|
|
$url = 'mailto:' . payfrit_get_option('venues_email') . '?subject=Large%20Venue%20Inquiry';
|
|
}
|
|
|
|
return sprintf('<a href="%s" class="%s">%s</a>', esc_url($url), esc_attr($class), esc_html($text));
|
|
}
|