/** * Do not edit anything in this file unless you know what you're doing */ use Roots\Sage\Config; use Roots\Sage\Container; /** * Helper function for prettying up errors * @param string $message * @param string $subtitle * @param string $title */ $sage_error = function ($message, $subtitle = '', $title = '') { $title = $title ?: __('Sage › Error', 'sage'); $footer = 'roots.io/sage/docs/'; $message = "
{$message}
{$footer}
"; wp_die($message, $title); }; /** * Ensure compatible version of PHP is used */ if (version_compare('7.1', phpversion(), '>=')) { $sage_error(__('You must be using PHP 7.1 or greater.', 'sage'), __('Invalid PHP version', 'sage')); } /** * Ensure compatible version of WordPress is used */ if (version_compare('4.7.0', get_bloginfo('version'), '>=')) { $sage_error(__('You must be using WordPress 4.7.0 or greater.', 'sage'), __('Invalid WordPress version', 'sage')); } /** * Ensure dependencies are loaded */ if (!class_exists('Roots\\Sage\\Container')) { if (!file_exists($composer = __DIR__.'/../vendor/autoload.php')) { $sage_error( __('You must runcomposer install from the Sage directory.', 'sage'),
__('Autoloader not found.', 'sage')
);
}
require_once $composer;
}
/**
* Sage required files
*
* The mapped array determines the code library included in your theme.
* Add or remove files to the array as needed. Supports child theme overrides.
*/
array_map(function ($file) use ($sage_error) {
$file = "../app/{$file}.php";
if (!locate_template($file, true, true)) {
$sage_error(sprintf(__('Error locating %s for inclusion.', 'sage'), $file), 'File not found');
}
}, ['helpers', 'setup', 'filters', 'admin']);
/**
* Here's what's happening with these hooks:
* 1. WordPress initially detects theme in themes/sage/resources
* 2. Upon activation, we tell WordPress that the theme is actually in themes/sage/resources/views
* 3. When we call get_template_directory() or get_template_directory_uri(), we point it back to themes/sage/resources
*
* We do this so that the Template Hierarchy will look in themes/sage/resources/views for core WordPress themes
* But functions.php, style.css, and index.php are all still located in themes/sage/resources
*
* This is not compatible with the WordPress Customizer theme preview prior to theme activation
*
* get_template_directory() -> /srv/www/example.com/current/web/app/themes/sage/resources
* get_stylesheet_directory() -> /srv/www/example.com/current/web/app/themes/sage/resources
* locate_template()
* ├── STYLESHEETPATH -> /srv/www/example.com/current/web/app/themes/sage/resources/views
* └── TEMPLATEPATH -> /srv/www/example.com/current/web/app/themes/sage/resources
*/
array_map(
'add_filter',
['theme_file_path', 'theme_file_uri', 'parent_theme_file_path', 'parent_theme_file_uri'],
array_fill(0, 4, 'dirname')
);
Container::getInstance()
->bindIf('config', function () {
return new Config([
'assets' => require dirname(__DIR__).'/config/assets.php',
'theme' => require dirname(__DIR__).'/config/theme.php',
'view' => require dirname(__DIR__).'/config/view.php',
]);
}, true);
function themeslug_theme_customizer($wp_customize) {
$wp_customize->add_section('theme_logo_section', array(
'title' => __('Theme Logo', 'theme'),
'priority' => 35,
'description' => 'Upload a logo to replace the default site name and description in the header',
));
$wp_customize->add_setting('theme_logo');
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'theme_logo', array(
'label' => __('Logo', 'theme'),
'section' => 'theme_logo_section',
'settings' => 'theme_logo',
)));
$wp_customize->add_setting('foo_logo');
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'foo_logo', array(
'label' => __('Footer Logo', 'theme'),
'section' => 'theme_logo_section',
'settings' => 'foo_logo',
)));
}
add_action('customize_register', 'themeslug_theme_customizer');
require_once('wp_bootstrap_navwalker.php');
if( function_exists('acf_add_options_page') ) {
acf_add_options_page(array(
'page_title' => 'General Company Information',
'menu_title' => 'Company Information',
'menu_slug' => 'theme-general-settings',
'capability' => 'edit_posts',
'redirect' => false
));
}
function custom_secondary_header() {
$labels = array(
'name' => _x( 'Home Header', 'Post Type General Name', 'sage' ),
'singular_name' => _x( 'Home Header', 'Post Type Singular Name', 'sage' ),
'menu_name' => __( 'Home Header','sage' ),
'name_admin_bar' => __( 'Home Headers', 'sage' ),
);
$args = array(
'label' => __( 'Home Header', 'sage' ),
'labels' => $labels,
'supports' => array( 'title', 'thumbnail', ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_icon' => 'dashicons-images-alt2',
'menu_position' => 5,
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => false,
'exclude_from_search' => true,
'publicly_queryable' => true,
'capability_type' => 'page',
);
register_post_type( 'home_header', $args );
$labels = array(
'name' => _x( 'Secondary Header', 'Post Type General Name', 'sage' ),
'singular_name' => _x( 'Secondary Header', 'Post Type Singular Name', 'sage' ),
'menu_name' => __( 'Secondary Header','sage' ),
'name_admin_bar' => __( 'Secondary Headers', 'sage' ),
);
$args = array(
'label' => __( 'Secondary Header', 'sage' ),
'labels' => $labels,
'supports' => array( 'title', 'thumbnail', ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_icon' => 'dashicons-images-alt2',
'menu_position' => 5,
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => false,
'exclude_from_search' => true,
'publicly_queryable' => true,
'capability_type' => 'page',
);
register_post_type('secondary_header', $args );
$servicelabels = array(
'name' => 'Testimonials',
'singular_name' => 'Testimonial',
'menu_name' => 'Testimonials',
'name_admin_bar' => 'Testimonials',
'archives' => 'Testimonial Archives',
'attributes' => 'Testimonial Attributes',
'parent_item_colon' => 'Parent Testimonial:',
'all_items' => 'All Testimonials',
'add_new_item' => 'Add New Testimonial',
'add_new' => 'Add New',
'new_item' => 'New Testimonial',
'edit_item' => 'Edit Testimonial',
'update_item' => 'Update Testimonial',
'view_item' => 'View Testimonial',
'view_items' => 'View Testimonials',
'search_items' => 'Search Testimonial',
'not_found' => 'Not found',
'not_found_in_trash' => 'Not found in Trash',
'featured_image' => 'Featured Image',
'set_featured_image' => 'Set featured image',
'remove_featured_image' => 'Remove featured image',
'use_featured_image' => 'Use as featured image',
'insert_into_item' => 'Insert into Testimonial',
'uploaded_to_this_item' => 'Uploaded to this Testimonial',
'items_list' => 'Testimonials list',
'items_list_navigation' => 'Testimonials list navigation',
'filter_items_list' => 'Filter Testimonials list',
);
$testimonialargs = array(
'label' => 'Testimonial',
'description' => 'Testimonials will be updated and managed here',
'labels' => $servicelabels,
'supports' => array( 'title', 'editor', '', '', ),
'taxonomies' => array( '', '' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 15,
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => false,
'exclude_from_search' => true,
'publicly_queryable' => true,
'capability_type' => 'page',
);
register_post_type( 'testimonial', $testimonialargs );
$labels = array(
'name' => _x( 'Faqs', 'Post Type General Name', 'chooselifemarketing' ),
'singular_name' => _x( 'Faq', 'Post Type Singular Name', 'chooselifemarketing' ),
'menu_name' => __( 'Faqs', 'chooselifemarketing' ),
'name_admin_bar' => __( 'Faqs', 'chooselifemarketing' ),
'archives' => __( 'Faqs Archives', 'chooselifemarketing' ),
'attributes' => __( 'Faqs Attributes', 'chooselifemarketing' ),
'parent_item_colon' => __( 'Parent Faqs:', 'chooselifemarketing' ),
'all_items' => __( 'All Faqs', 'chooselifemarketing' ),
'add_new_item' => __( 'Add New faq', 'chooselifemarketing' ),
'add_new' => __( 'Add New', 'chooselifemarketing' ),
'new_item' => __( 'New faq', 'chooselifemarketing' ),
'edit_item' => __( 'Edit faq', 'chooselifemarketing' ),
'update_item' => __( 'Update faq', 'chooselifemarketing' ),
'view_item' => __( 'View faq', 'chooselifemarketing' ),
'view_items' => __( 'View Faq', 'chooselifemarketing' ),
'search_items' => __( 'Search Faqs', 'chooselifemarketing' ),
'not_found' => __( 'Not found', 'chooselifemarketing' ),
'not_found_in_trash' => __( 'Not found in Trash', 'chooselifemarketing' ),
'featured_image' => __( 'Featured Image', 'chooselifemarketing' ),
'set_featured_image' => __( 'Set featured image', 'chooselifemarketing' ),
'remove_featured_image' => __( 'Remove featured image', 'chooselifemarketing' ),
'use_featured_image' => __( 'Use as featured image', 'chooselifemarketing' ),
'insert_into_item' => __( 'Insert into faq', 'chooselifemarketing' ),
'uploaded_to_this_item' => __( 'Uploaded to this faq', 'chooselifemarketing' ),
'items_list' => __( 'faq list', 'chooselifemarketing' ),
'items_list_navigation' => __( 'faq list navigation', 'chooselifemarketing' ),
'filter_items_list' => __( 'Filter faq list', 'chooselifemarketing' ),
);
$args = array(
'label' => __( 'Faq', 'chooselifemarketing' ),
'description' => __( 'Post Type Description', 'chooselifemarketing' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'thumbnail', 'revisions', ),
'taxonomies' => array( 'category', 'post_tag' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 15,
'menu_icon' => 'dashicons-format-status',
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
);
register_post_type( 'faqs', $args );
}
add_action( 'init', 'custom_secondary_header', 0 );
function sidebar_testimonial( $atts ) {
extract(shortcode_atts(array(
'order' => 'asc'
), $atts));
$output = '';
$i = 1;
$output .='