__( 'Top Menu', 'cactus' ), 'home' => __( 'Front Page Top Menu', 'cactus' ), ) ); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support( 'html5', array( 'comment-form', 'comment-list', 'gallery', 'caption', ) ); // Add theme support for Custom Logo. add_theme_support( 'custom-logo', array( 'width' => 152, 'height' => 50, 'flex-width' => true, ) ); // Setup the WordPress core custom header feature. add_theme_support( 'custom-header', array( 'default-image' => '', 'random-default' => false, 'width' => '1920', 'height' => '70', 'flex-height' => true, 'flex-width' => true, 'default-text-color' => '#333333', 'header-text' => true, 'uploads' => true, 'wp-head-callback' => '', 'admin-head-callback' => '', 'admin-preview-callback' => '' )); // Setup the WordPress core custom background feature. add_theme_support( 'custom-background', array( 'default-color' => 'ffffff', 'default-image' => '', ) ); // Add theme support for selective refresh for widgets. add_theme_support( 'customize-selective-refresh-widgets' ); // Woocommerce Support add_theme_support( 'woocommerce' ); /* * This theme styles the visual editor to resemble the theme style, * specifically font, colors, and column width. */ add_editor_style( array( 'assets/css/editor-style.css' ) ); } add_action( 'after_setup_theme', 'cactus_setup' ); /** * Enqueue scripts and styles. */ function cactus_scripts() { global $cactus_options, $cactus_sections; $cactus_options = get_option(CACTUS_TEXTDOMAIN); $headings_font_family = esc_attr(cactus_option( 'headings_font_family')); $body_font_family = esc_attr(cactus_option( 'body_font_family')); $fonts[] = $headings_font_family; $fonts[] = $body_font_family; wp_enqueue_style( 'cactus-google-fonts', customizer_library_get_google_font_uri($fonts), false, '', false ); wp_enqueue_style( 'bootstrap', get_template_directory_uri() .'/assets/plugins/bootstrap/css/bootstrap.css', false, '', false ); wp_enqueue_style( 'font-awesome', get_template_directory_uri() .'/assets/plugins/font-awesome/css/font-awesome.min.css', false, '', false ); wp_enqueue_style( 'owl-carousel', get_template_directory_uri() .'/assets/plugins/owl-carousel/css/owl.carousel.css', false, '', false ); // Theme stylesheet. wp_enqueue_style( 'cactus-style', get_stylesheet_uri() ); if(is_page_template( 'template-sections.php' )){ wp_enqueue_style( 'cactus-frontpage', get_template_directory_uri() .'/assets/css/frontpage.css' ); wp_enqueue_style( 'animate', get_template_directory_uri() .'/assets/plugins/animate.css' ); } wp_enqueue_script( 'bootstrap', get_template_directory_uri() . '/assets/plugins/bootstrap/js/bootstrap.js' , array( 'jquery' ), null, true); wp_enqueue_script( 'cactus-main', get_template_directory_uri() . '/assets/js/cactus.js' , array( 'jquery' ), null, true); wp_enqueue_script( 'respond', get_template_directory_uri() . '/assets/plugins/respond.min.js' , array( 'jquery' ), null, true); wp_enqueue_script( 'owl-carousel', get_template_directory_uri() . '/assets/plugins/owl-carousel/js/owl.carousel.min.js' , array( 'jquery' ), null, true); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } $custom_css = ''; $header_text_color = get_header_textcolor(); if ( 'blank' != $header_text_color ) : $custom_css .= ".site-name, .site-tagline { color: #".esc_attr( $header_text_color )." !important; }\r\n"; else: $custom_css .= ".site-name, .site-tagline { display: none; }\r\n"; endif; // Font $custom_css .= "h1,h2,h3,h4,h5,h6{font-family:".$headings_font_family.";}"; $custom_css .= "html, body, div, span, applet, object, iframe, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {font-family:".$body_font_family.";}"; $body_font_size = absint(cactus_option('body_font_size')); $custom_css .= "html, body, div{font-size:".$body_font_size."px;}"; for($i=1;$i<=6;$i++){ $heading_font_size = absint(cactus_option('h'.$i.'_font_size')); $custom_css .= "h".$i."{font-size:".$heading_font_size."px;}"; } foreach($cactus_sections as $key=>$name ){ $font_color = cactus_option('font_color_'.$key); $background_color = cactus_option('background_color_'.$key); $background_image = cactus_option('background_image_'.$key); if (is_numeric($background_image)) { $image_attributes = wp_get_attachment_image_src($background_image, 'full'); $background_image = $image_attributes[0]; } $custom_css .= ".cactus-section-".$key." { background-color:".esc_attr( $background_color )."; background-image:url(".esc_attr( $background_image )."); }\r\n"; $custom_css .= ".cactus-section-".$key." div, .cactus-section-".$key." span, .cactus-section-".$key." h1,.cactus-section-".$key." h2,.cactus-section-".$key." h3,.cactus-section-".$key." h4,.cactus-section-".$key." h5,.cactus-section-".$key." h6,.cactus-section-".$key." p, .cactus-section-".$key." li {color:".esc_attr($font_color).";}"; } wp_add_inline_style( 'cactus-style', wp_filter_nohtml_kses($custom_css) ); } add_action( 'wp_enqueue_scripts', 'cactus_scripts' ); /** * Prints HTML with meta information for the current post-date/time and author. */ function cactus_posted_on() { // Get the author name; wrap it in a link. $byline = sprintf( /* translators: %s: post author */ __( 'by %s', 'cactus' ), '' ); // Finally, let's write all of this to the page. echo '' . cactus_time_link() . ' | ' . $byline . ''; } /** * Gets a nicely formatted string for the published date. */ function cactus_time_link() { $time_string = ''; $time_string = sprintf( $time_string, get_the_date( DATE_W3C ), get_the_date(), get_the_modified_date( DATE_W3C ), get_the_modified_date() ); // Wrap the time string in a link, and preface it with 'Posted on'. return sprintf( /* translators: %s: post date */ __( 'Posted on %s ', 'cactus' ), '' . $time_string . '' ); } /** * Returns an accessibility-friendly link to edit a post or page. */ function cactus_edit_link() { $link = edit_post_link( sprintf( /* translators: %s: Name of current post */ __( 'Edit "%s"', 'cactus' ), get_the_title() ), '', '' ); return $link; } /** * Register widget area. * */ function cactus_widgets_init() { register_sidebar( array( 'name' => __( 'Sidebar', 'cactus' ), 'id' => 'sidebar-1', 'description' => __( 'Add widgets here to appear in your sidebar.', 'cactus' ), 'before_widget' => '', 'before_title' => '