theme and plugin sync
This commit is contained in:
208
includes/back-end/acf_functions.php
Normal file
208
includes/back-end/acf_functions.php
Normal file
@@ -0,0 +1,208 @@
|
||||
<?php
|
||||
|
||||
//ACF USER MANAGER
|
||||
|
||||
function my_acf_user_form_func($atts, $showForm, $register)
|
||||
{
|
||||
acf_link_to_tab();
|
||||
$a = shortcode_atts(array(
|
||||
'field_group' => ''
|
||||
), $atts);
|
||||
$uid = get_current_user_id();
|
||||
|
||||
if ($register || (!empty($a['field_group']) && !empty($uid))) {
|
||||
$options = array(
|
||||
'post_id' => 'user_' . $uid,
|
||||
'field_groups' => array(intval($a['field_group'])),
|
||||
'updated_message' => $register ? "Profile Registered" : "Profile Updated",
|
||||
//'submit_value' => $register ? "Register" :"Update",
|
||||
/*Choices of 'top' (Above fields) or 'left' (Beside fields) */
|
||||
'label_placement' => 'left',
|
||||
'html_submit_button' => '<div class="et_pb_button_module_wrapper et_pb_button_8_wrapper et_pb_button_alignment_center et_pb_module "><a style="color: #8fbb4a;" class="et_pb_button et_pb_button_0 et_pb_bg_layout_light" href="javascript:jQuery(\'#acf-form\').submit();">' . ($register ? "Save" : "Update") . '</a></div>',
|
||||
//'<input type="submit" class="acf-button button button-primary button-large" value="%s" />',
|
||||
/* (boolean) Whether or not to create a form element. Useful when a adding to an existing form. Defaults to true */
|
||||
'form' => $showForm,
|
||||
'return' => add_query_arg('updated', 'true', get_permalink())
|
||||
);
|
||||
|
||||
ob_start();
|
||||
|
||||
acf_form($options);
|
||||
$form = ob_get_contents();
|
||||
|
||||
ob_end_clean();
|
||||
}
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
function my_acf_user_form_showProfile($atts)
|
||||
{
|
||||
return my_acf_user_form_func($atts, false, false);
|
||||
}
|
||||
function my_acf_user_form_editProfile($atts)
|
||||
{
|
||||
return my_acf_user_form_func($atts, true, false);
|
||||
}
|
||||
|
||||
function my_acf_user_form_register($atts)
|
||||
{
|
||||
return my_acf_user_form_func($atts, true, true);
|
||||
}
|
||||
|
||||
add_shortcode('my_acf_user_form', 'my_acf_user_form_editProfile');
|
||||
|
||||
add_shortcode('my_acf_user_show_form', 'my_acf_user_form_showProfile');
|
||||
|
||||
add_shortcode('my_acf_user_register_form', 'my_acf_user_form_register');
|
||||
|
||||
//adding AFC form head
|
||||
function add_acf_form_head()
|
||||
{
|
||||
global $post;
|
||||
|
||||
if (!empty($post) && (has_shortcode($post->post_content, 'my_acf_user_form') || has_shortcode($post->post_content, 'my_acf_user_show_form') || has_shortcode($post->post_content, 'my_acf_user_register_form'))) {
|
||||
acf_form_head();
|
||||
}
|
||||
/*if ( !empty($post) && ( has_shortcode( $post->post_content, 'my_acf_user_register_form' )) ) {
|
||||
|
||||
|
||||
//create user first
|
||||
//prepare basic user info
|
||||
$password = wp_generate_password( 10, true, false );
|
||||
$username = $_POST['fields']['field_5dbca1ef8994b'];
|
||||
$email = $_POST['fields']['field_5dbca1ef8994b'];
|
||||
|
||||
//register user
|
||||
$user_id = wp_create_user( $username, $password, $email );
|
||||
|
||||
wp_update_user( array(
|
||||
'ID' => $user_id,
|
||||
'first_name' => $_POST['fields']['field_5dbc8a9f6d904'],
|
||||
'last_name' => $_POST['fields']['field_5dbc8ad36d905'],
|
||||
'display_name' => $_POST['fields']['field_5dbc8a9f6d904'] . ' ' . $_POST['fields']['field_5dbc8ad36d905']
|
||||
) );
|
||||
|
||||
acf_form_head();
|
||||
}*/
|
||||
}
|
||||
add_action('wp_head', 'add_acf_form_head', 7);
|
||||
|
||||
|
||||
// set ACF pre-save stuff
|
||||
add_filter('acf/pre_save_post', 'acf_create_new_user');
|
||||
|
||||
function acf_create_new_user($post_id)
|
||||
{
|
||||
|
||||
global $post;
|
||||
|
||||
if (!empty($post) && (has_shortcode($post->post_content, 'my_acf_user_register_form'))) {
|
||||
error_log('post id: ' . $post_id);
|
||||
|
||||
// // exit if user already logged in, front-end form sent his ID
|
||||
// if ( $post_id != 'new' ) {
|
||||
|
||||
// error_log( 'post not new: ' . $post_id);
|
||||
// // wp_redirect( home_url() );
|
||||
// return $post_id;
|
||||
|
||||
// }
|
||||
|
||||
$field_group = acf_get_fields_by_id('4067');
|
||||
|
||||
//prepare basic user info
|
||||
foreach ($field_group as $key => $value) {
|
||||
//
|
||||
"<br/>+++<br/>" . $value['name'];
|
||||
//echo ":".$_POST['acf'][$value['key']]."<br/>+++<br/>";
|
||||
${$value['name']} = $_POST['acf'][$value['key']];
|
||||
}
|
||||
|
||||
$password = wp_generate_password(10, true, false);
|
||||
$username = $email;
|
||||
$display_name = $first_name . ' ' . $last_name;
|
||||
|
||||
// check if user exists, exit if so
|
||||
if (email_exists($email)) {
|
||||
|
||||
error_log('email exists: ' . $email);
|
||||
wp_redirect(home_url() . '/email-exists?email_exists&user_email=' . $email);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// register user
|
||||
$user_id = wp_create_user($username, $password, $email);
|
||||
error_log('guy just created: ' . $user_id);
|
||||
|
||||
|
||||
// Fetch the WP_User object of our user.
|
||||
$u = new WP_User($user_id);
|
||||
|
||||
// Replace the current role with 'editor' role
|
||||
$u->set_role($role);
|
||||
|
||||
// update other user info
|
||||
wp_update_user(array(
|
||||
|
||||
'ID' => $user_id,
|
||||
'first_name' => $first_name,
|
||||
'last_name' => $last_name,
|
||||
'display_name' => $display_name
|
||||
|
||||
));
|
||||
|
||||
// update_user_meta( $user_id, '_um_status', 'pending' );
|
||||
|
||||
|
||||
// update other user meta, prevent creation of post data
|
||||
foreach ($field_group as $key => $value) {
|
||||
|
||||
update_user_meta($user_id, $value['name'], $_POST['acf'][$value['key']]);
|
||||
unset($_POST['acf'][$value['key']]);
|
||||
}
|
||||
|
||||
update_user_meta($user_id, 'account_status', 'awaiting_admin_review');
|
||||
//wp_new_user_notification( $user_id, $password);
|
||||
|
||||
// redirect to login page after finish
|
||||
wp_redirect(home_url() . '/registered?new_user=true&user_email=' . $email);
|
||||
exit; //return 'user_' . $user_id;
|
||||
}
|
||||
return $post_id;
|
||||
}
|
||||
|
||||
add_filter('acf/validate_value/name=email', 'my_acf_validate_email', 10, 4);
|
||||
|
||||
function my_acf_validate_email($valid, $value, $field, $input)
|
||||
{
|
||||
|
||||
if (filter_var($value, FILTER_VALIDATE_EMAIL)) {
|
||||
return $valid;
|
||||
} else {
|
||||
$valid = "$value is not a valid email address";
|
||||
}
|
||||
return $valid;
|
||||
}
|
||||
|
||||
|
||||
function acf_link_to_tab()
|
||||
{ ?>
|
||||
<script>
|
||||
(function($) {
|
||||
acf.add_action('ready', function() {
|
||||
if (location.hash.length > 1) {
|
||||
var hash = location.hash.substring(1);
|
||||
$('.acf-tab-wrap .acf-tab-button').each(function(i, button) {
|
||||
if (hash == $(button).text().toLowerCase().replace(' ', '-')) {
|
||||
$(button).trigger('click');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
</script><?php
|
||||
}
|
18
includes/back-end/editor_styles_and_scripts.php
Normal file
18
includes/back-end/editor_styles_and_scripts.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Editor styles and scripts.
|
||||
*
|
||||
* @package ThemeStarter
|
||||
*/
|
||||
|
||||
function themeStarter_editor_enqueue()
|
||||
{
|
||||
add_theme_support('editor-styles');
|
||||
|
||||
add_editor_style([
|
||||
'assets/css/styles.css',
|
||||
'assets/css/bootstrap-icons.css',
|
||||
'assets/css/font-awesome.css'
|
||||
]);
|
||||
}
|
78
includes/back-end/helper_functions.php
Normal file
78
includes/back-end/helper_functions.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Helper functions.
|
||||
*
|
||||
* @package ThemeStarter
|
||||
*/
|
||||
|
||||
// Get List of Sub Categories for Slug
|
||||
function getSubpagesForSlug($arrayOfWPPages, $slug)
|
||||
{
|
||||
foreach ($arrayOfWPPages as $page) {
|
||||
if ($page['page']->post_name === $slug) {
|
||||
return $page['subpages'];
|
||||
}
|
||||
}
|
||||
// Return an empty array if the slug is not found
|
||||
return [];
|
||||
}
|
||||
|
||||
// Return WordPress Page For A Slug
|
||||
function getPageForSlug($arrayOfWPPages, $slug)
|
||||
{
|
||||
foreach ($arrayOfWPPages as $page) {
|
||||
if ($page['page']->post_name === $slug) {
|
||||
return $page['page'];
|
||||
}
|
||||
|
||||
foreach ($page['subpages'] as $index => $subpage) {
|
||||
if ($subpage->post_name === $slug) {
|
||||
|
||||
return $page['subpages'][$index];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Return an empty array if the slug is not found
|
||||
return [];
|
||||
}
|
||||
|
||||
function ddd($variable)
|
||||
{
|
||||
echo '<pre>';
|
||||
var_dump($variable);
|
||||
echo '<pre>';
|
||||
}
|
||||
|
||||
// Get An Array of Top Level Pages and their Subpages
|
||||
function get_pages_as_array()
|
||||
{
|
||||
|
||||
$args = [
|
||||
'sort_order' => 'ASC',
|
||||
'sort_column' => 'menu_order',
|
||||
'hierarchical' => 1,
|
||||
'exclude' => [237, 238]
|
||||
];
|
||||
|
||||
$pages = get_pages($args);
|
||||
$page_hierarchy = array();
|
||||
|
||||
foreach ($pages as $page) {
|
||||
$parent_id = $page->post_parent;
|
||||
|
||||
// If it's a top-level page
|
||||
if ($parent_id == 0) {
|
||||
$page_hierarchy[$page->ID] = array(
|
||||
'page' => $page,
|
||||
'subpages' => array()
|
||||
);
|
||||
} else {
|
||||
// If it's a child page, add it under its parent
|
||||
$page_hierarchy[$parent_id]['subpages'][] = $page;
|
||||
}
|
||||
}
|
||||
|
||||
return $page_hierarchy;
|
||||
}
|
17
includes/back-end/query_adjustments.php
Normal file
17
includes/back-end/query_adjustments.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Query Adjustments.
|
||||
*
|
||||
* @package ThemeStarter
|
||||
*/
|
||||
|
||||
function themeStarter_adjust_queries($query)
|
||||
{
|
||||
|
||||
// Search Page Query Adjustment
|
||||
if ($query->is_search()) {
|
||||
$query->set('posts_per_page', '-1');
|
||||
$query->set('order', 'ASC');
|
||||
}
|
||||
}
|
65
includes/back-end/required_plugins.php
Normal file
65
includes/back-end/required_plugins.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
// REQUIRED PLUGINS
|
||||
|
||||
require_once get_theme_file_path('/class-tgm-plugin-activation.php');
|
||||
|
||||
add_action('tgmpa_register', 'my_theme_register_required_plugins');
|
||||
|
||||
function my_theme_register_required_plugins()
|
||||
{
|
||||
/*
|
||||
* Array of plugin arrays. Required keys are name and slug.
|
||||
* If the source is NOT from the .org repo, then source is also required.
|
||||
*/
|
||||
$plugins = [
|
||||
[
|
||||
'name' => 'All In One SEO',
|
||||
'slug' => 'all-in-one-seo-pack',
|
||||
'required' => false,
|
||||
],
|
||||
[
|
||||
'name' => 'Advanced Custom Fields',
|
||||
'slug' => 'advanced-custom-fields',
|
||||
'required' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'Auto Dealer Forms',
|
||||
'slug' => 'auto-dealer-forms',
|
||||
'source' => get_template_directory_uri() . '/bundled_plugins/auto-dealer-forms.zip',
|
||||
'required' => true,
|
||||
]
|
||||
];
|
||||
|
||||
/*
|
||||
* Array of configuration settings. Amend each line as needed.
|
||||
*
|
||||
* TGMPA will start providing localized text strings soon. If you already have translations of our standard
|
||||
* strings available, please help us make TGMPA even better by giving us access to these translations or by
|
||||
* sending in a pull-request with .po file(s) with the translations.
|
||||
*
|
||||
* Only uncomment the strings in the config array if you want to customize the strings.
|
||||
*/
|
||||
$config = array(
|
||||
'id' => 'tgmpa', // Unique ID for hashing notices for multiple instances of TGMPA.
|
||||
'default_path' => '', // Default absolute path to bundled plugins.
|
||||
'menu' => 'tgmpa-install-plugins', // Menu slug.
|
||||
'parent_slug' => 'themes.php', // Parent menu slug.
|
||||
'capability' => 'edit_theme_options', // Capability needed to view plugin install page, should be a capability associated with the parent menu used.
|
||||
'has_notices' => true, // Show admin notices or not.
|
||||
'dismissable' => true, // If false, a user cannot dismiss the nag message.
|
||||
'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag.
|
||||
'is_automatic' => false, // Automatically activate plugins after installation or not.
|
||||
'message' => '', // Message to output right before the plugins table.
|
||||
/*
|
||||
'strings' => array(
|
||||
'page_title' => __( 'Install Required Plugins', 'theme-slug' ),
|
||||
'menu_title' => __( 'Install Plugins', 'theme-slug' ),
|
||||
// <snip>...</snip>
|
||||
'nag_type' => 'updated', // Determines admin notice type - can only be 'updated', 'update-nag' or 'error'.
|
||||
)
|
||||
*/
|
||||
);
|
||||
|
||||
tgmpa($plugins, $config);
|
||||
}
|
37
includes/back-end/template_content_update.php
Normal file
37
includes/back-end/template_content_update.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Update wordpress content on admin init.
|
||||
*
|
||||
* @package ThemeStarter
|
||||
*/
|
||||
|
||||
|
||||
function update_page_content_from_file()
|
||||
{
|
||||
// Get all pages
|
||||
$pages = get_pages();
|
||||
|
||||
foreach ($pages as $page) {
|
||||
$slug = $page->post_name;
|
||||
$file_path = get_template_directory() . '/templates/internal/' . $slug . '.php';
|
||||
|
||||
// Check if the file exists
|
||||
if (file_exists($file_path)) {
|
||||
// Start output buffering to capture PHP output
|
||||
ob_start();
|
||||
|
||||
// Include the file to execute its PHP code
|
||||
include($file_path);
|
||||
|
||||
// Get the output and clean the output buffer
|
||||
$file_content = ob_get_clean();
|
||||
|
||||
// Update the page content
|
||||
wp_update_post(array(
|
||||
'ID' => $page->ID,
|
||||
'post_content' => $file_content,
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
146
includes/back-end/woo_functions.php
Normal file
146
includes/back-end/woo_functions.php
Normal file
@@ -0,0 +1,146 @@
|
||||
<?php
|
||||
|
||||
add_filter('gettext', 'bbloomer_translate_woocommerce_strings', 999, 3);
|
||||
|
||||
function bbloomer_translate_woocommerce_strings($translated, $text, $domain)
|
||||
{
|
||||
if (!is_admin() && 'woocommerce' === $domain) {
|
||||
|
||||
switch (strtolower($translated)) {
|
||||
|
||||
case 'view cart':
|
||||
$translated = 'View Cart';
|
||||
break;
|
||||
|
||||
case 'proceed to checkout':
|
||||
$translated = 'Checkout Resources';
|
||||
break;
|
||||
|
||||
case 'checkout':
|
||||
$translated = 'Checkout Resources';
|
||||
break;
|
||||
|
||||
case 'add to cart':
|
||||
$translated = 'Add to Cart';
|
||||
break;
|
||||
|
||||
case 'place order':
|
||||
$translated = 'Complete Checkout';
|
||||
break;
|
||||
|
||||
case 'your order':
|
||||
$translated = 'Your Order';
|
||||
break;
|
||||
|
||||
case 'product':
|
||||
$translated = 'Product';
|
||||
break;
|
||||
|
||||
case 'products':
|
||||
$translated = 'Products';
|
||||
break;
|
||||
|
||||
case 'cart totals':
|
||||
$translated = 'Cart Totals';
|
||||
break;
|
||||
|
||||
case 'browse products':
|
||||
$translated = 'Browse Products';
|
||||
break;
|
||||
|
||||
case 'orders':
|
||||
$translated = 'Orders';
|
||||
break;
|
||||
|
||||
case 'return to shop':
|
||||
$translated = 'Find More Products';
|
||||
break;
|
||||
|
||||
// enter a new case for each line where you want Woocommerce text to be changed.
|
||||
}
|
||||
}
|
||||
return $translated;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------
|
||||
|
||||
// Continue Shopping Button Redirect
|
||||
add_filter('woocommerce_continue_shopping_redirect', function () {
|
||||
return get_home_url() . '/shop';
|
||||
});
|
||||
|
||||
function woo_add_continue_shopping_button_to_single()
|
||||
{
|
||||
$shop_page_url = get_permalink(woocommerce_get_page_id('shop'));
|
||||
|
||||
echo '<div class="woocommerce-message">';
|
||||
echo ' <a href="' . $shop_page_url . '" class="button wc-forward">Continue Shopping</a>Looking for more items to add?';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Add Continue Shopping Button on Cart Page
|
||||
* Add to theme functions.php file or Code Snippets plugin
|
||||
*/
|
||||
add_action('woocommerce_before_cart', 'woo_add_continue_shopping_button_to_cart');
|
||||
|
||||
function woo_add_continue_shopping_button_to_cart()
|
||||
{
|
||||
$shop_page_url = get_permalink(woocommerce_get_page_id('shop'));
|
||||
|
||||
echo '<div class="woocommerce-message">';
|
||||
echo ' <a href="' . $shop_page_url . '" class="button wc-forward">Find More Resources</a>Looking for more items to add?';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
Remove Unwanted Woocommerce Fields
|
||||
**/
|
||||
function wc_remove_checkout_fields($fields)
|
||||
{
|
||||
|
||||
// Billing fields
|
||||
unset($fields['billing']['billing_company']);
|
||||
// unset($fields['billing']['billing_email']);
|
||||
unset($fields['billing']['billing_phone']);
|
||||
unset($fields['billing']['billing_state']);
|
||||
unset($fields['billing']['billing_first_name']);
|
||||
unset($fields['billing']['billing_last_name']);
|
||||
unset($fields['billing']['billing_address_1']);
|
||||
unset($fields['billing']['billing_address_2']);
|
||||
unset($fields['billing']['billing_city']);
|
||||
// unset($fields['billing']['billing_postcode']);
|
||||
|
||||
// Shipping fields
|
||||
unset($fields['shipping']['shipping_company']);
|
||||
unset($fields['shipping']['shipping_phone']);
|
||||
// unset($fields['shipping']['shipping_state']);
|
||||
// unset($fields['shipping']['shipping_first_name']);
|
||||
// unset($fields['shipping']['shipping_last_name']);
|
||||
// unset($fields['shipping']['shipping_address_1']);
|
||||
unset($fields['shipping']['shipping_address_2']);
|
||||
// unset($fields['shipping']['shipping_city']);
|
||||
// unset($fields['shipping']['shipping_postcode']);
|
||||
|
||||
// Order fields
|
||||
// unset($fields['order']['order_comments']);
|
||||
|
||||
return $fields;
|
||||
}
|
||||
// add_filter('woocommerce_checkout_fields', 'wc_remove_checkout_fields');
|
||||
|
||||
/**
|
||||
Reorder Woocommerce Billing Fields
|
||||
**/
|
||||
|
||||
add_filter('woocommerce_checkout_fields', 'quadlayers_email_top');
|
||||
|
||||
function quadlayers_email_top($checkout_fields)
|
||||
{
|
||||
$checkout_fields['billing']['billing_email']['priority'] = 5;
|
||||
return $checkout_fields;
|
||||
}
|
25
includes/front-end/custom_login_screen.php
Normal file
25
includes/front-end/custom_login_screen.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Site login.
|
||||
*
|
||||
* @package ThemeStarter
|
||||
*/
|
||||
|
||||
// Change Login Page header url
|
||||
function ourHeaderUrl()
|
||||
{
|
||||
return esc_url(site_url('/'));
|
||||
}
|
||||
|
||||
// Make login title the name of our website
|
||||
function ourLoginTitle()
|
||||
{
|
||||
return get_bloginfo('name');
|
||||
}
|
||||
|
||||
// Enqueue out stylesheet for login screen
|
||||
function ourLoginCSS()
|
||||
{
|
||||
wp_enqueue_style('login styles', get_theme_file_uri('/assets/css/styles.css'));
|
||||
}
|
19
includes/front-end/registration_form_message.php
Normal file
19
includes/front-end/registration_form_message.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Site registration.
|
||||
*
|
||||
* @package ThemeStarter
|
||||
*/
|
||||
|
||||
// Change Registration Message
|
||||
function change_reg_message($message)
|
||||
{
|
||||
// change messages that contain 'Register'
|
||||
if (strpos($message, 'Register') !== FALSE) {
|
||||
$newMessage = "Register with " . get_bloginfo('name');
|
||||
return '<p class="message register">' . $newMessage . '</p>';
|
||||
} else {
|
||||
return $message;
|
||||
}
|
||||
}
|
29
includes/front-end/styles_and_scripts.php
Normal file
29
includes/front-end/styles_and_scripts.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Styles and Scripts.
|
||||
*
|
||||
* @package ThemeStarter
|
||||
*/
|
||||
|
||||
// Enqueue styles and scripts
|
||||
function themeStarter_enqueue()
|
||||
{
|
||||
$theme_version = filemtime(get_stylesheet_directory() . '/style.css');
|
||||
|
||||
/* Register and Enqueue Scripts */
|
||||
|
||||
wp_register_script('themeStarter-app', get_parent_theme_file_uri('/assets/js/index.js'), [], $theme_version, true);
|
||||
wp_enqueue_script('themeStarter-app');
|
||||
|
||||
/* Register and Enqueue Styles */
|
||||
|
||||
wp_register_style('themeStarter-styles', get_parent_theme_file_uri('/assets/css/styles.css'), [], $theme_version, 'all');
|
||||
wp_enqueue_style('themeStarter-styles');
|
||||
|
||||
wp_register_style('bootstrap-icons', get_parent_theme_file_uri('/assets/css/bootstrap-icons.css'), [], '1.11.1', 'all');
|
||||
wp_enqueue_style('bootstrap-icons');
|
||||
|
||||
wp_register_style('font-awesome', get_parent_theme_file_uri('/assets/css/font-awesome.css'), [], '6.4.2', 'all');
|
||||
wp_enqueue_style('font-awesome');
|
||||
}
|
85
includes/front-end/theme_starter_setup.php
Normal file
85
includes/front-end/theme_starter_setup.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Theme setup and features.
|
||||
*
|
||||
* @package ThemeStarter
|
||||
*/
|
||||
|
||||
function themeStarter_setup()
|
||||
{
|
||||
|
||||
/*
|
||||
* Make theme available for translation.
|
||||
* Translations can be filed in the /languages/ directory.
|
||||
*/
|
||||
|
||||
load_theme_textdomain('themeStarter', get_template_directory() . '/languages');
|
||||
|
||||
// Add default posts and comments RSS feed links to head.
|
||||
add_theme_support('automatic-feed-links');
|
||||
|
||||
/*
|
||||
* Let WordPress manage the document title.
|
||||
*/
|
||||
add_theme_support('title-tag');
|
||||
|
||||
/*
|
||||
* Enable support for Post Thumbnails on posts and pages.
|
||||
*/
|
||||
add_theme_support('post-thumbnails');
|
||||
//Support custom logo
|
||||
add_theme_support('custom-logo');
|
||||
|
||||
// Add menus.
|
||||
register_nav_menus(
|
||||
array(
|
||||
'primary' => __('Primary Menu', 'themeStarter'),
|
||||
'secondary' => __('Secondary Menu', 'themeStarter'),
|
||||
)
|
||||
);
|
||||
|
||||
/*
|
||||
* Switch default core markup for search form, comment form, and comments
|
||||
* to output valid HTML5.
|
||||
*/
|
||||
|
||||
add_theme_support(
|
||||
'html5',
|
||||
array(
|
||||
'search-form',
|
||||
'comment-form',
|
||||
'comment-list',
|
||||
'gallery',
|
||||
'caption',
|
||||
'style',
|
||||
'script'
|
||||
)
|
||||
);
|
||||
|
||||
/*
|
||||
* Enable support for Post Formats.
|
||||
*/
|
||||
|
||||
add_theme_support(
|
||||
'post-formats',
|
||||
array(
|
||||
'aside',
|
||||
'image',
|
||||
'video',
|
||||
'quote',
|
||||
'link',
|
||||
'gallery',
|
||||
'status',
|
||||
'audio',
|
||||
'chat'
|
||||
)
|
||||
);
|
||||
|
||||
// Enable Woocommerce Theme Support
|
||||
add_theme_support('woocommerce');
|
||||
add_theme_support('wc-product-gallery-zoom');
|
||||
add_theme_support('wc-product-gallery-lightbox');
|
||||
add_theme_support('wc-product-gallery-slider');
|
||||
}
|
||||
|
Reference in New Issue
Block a user