__( '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' );
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
/*
* 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 );
wp_enqueue_style( 'prettyphoto', get_template_directory_uri() .'/assets/plugins/prettyphoto/css/prettyPhoto.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);
wp_enqueue_script( 'jquery-waypoints', get_template_directory_uri() . '/assets/plugins/waypoints/jquery.waypoints.js' , array( 'jquery' ), null, true);
if(cactus_option('section_hide_counter')!='1')
wp_enqueue_script( 'jquery-counterup', get_template_directory_uri() . '/assets/plugins/counter-up/jquery.counterup.js' , array( 'jquery' ), null, true);
if(cactus_option('section_hide_works')!='1')
wp_enqueue_script( 'isotope-pkgd', get_template_directory_uri() . '/assets/plugins/isotope/isotope.pkgd.js' , array( 'jquery' ), null, true);
wp_enqueue_script( 'jquery-parallax', get_template_directory_uri() . '/assets/plugins/parallax/jquery.parallax-1.1.3.js' , array( 'jquery' ), null, true);
wp_enqueue_script( 'jquery-prettyphoto', get_template_directory_uri() . '/assets/plugins/prettyphoto/js/jquery.prettyPhoto.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 family
$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.";}";
// Font size
$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 ){
$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";
}
wp_add_inline_style( 'cactus-style', wp_filter_nohtml_kses($custom_css) );
}
add_action( 'wp_enqueue_scripts', 'cactus_scripts' );
/**
* Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
*/
function cactus_customize_controls_enqueue(){
wp_enqueue_style( 'cactus_library_customizer', get_template_directory_uri() . '/assets/css/customizer.css', '', '1.0.0', false );
wp_enqueue_script( 'cactus_library_customizer_controls', get_template_directory_uri() . '/assets/js/customizer.js', array( 'customize-preview', 'jquery-ui-sortable', 'jquery-ui-autocomplete' ), '1.0.0', true );
}
add_action( 'customize_controls_init', 'cactus_customize_controls_enqueue' );
function cactus_customize_preview_enqueue(){
wp_enqueue_script( 'cactus_library_customizer_preview', get_template_directory_uri() . '/assets/js/customizer-preview.js', array( 'jquery' ), '1.0.0', true );
}
add_action( 'customize_preview_init', 'cactus_customize_preview_enqueue' );
/**
* 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' ),
' ' . get_the_author() . ''
);
// 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' => '
',
) );
register_sidebar( array(
'name' => __( 'Page Sidebar', 'cactus' ),
'id' => 'sidebar-page',
'description' => __( 'Add widgets here to appear in your pages sidebar.', 'cactus' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Blog Sidebar', 'cactus' ),
'id' => 'sidebar-blog',
'description' => __( 'Add widgets here to appear in your posts sidebar.', 'cactus' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Archives', 'cactus' ),
'id' => 'sidebar-archives',
'description' => __( 'Add widgets here to appear in your posts list sidebar.', 'cactus' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer 1', 'cactus' ),
'id' => 'footer-1',
'description' => __( 'Add widgets here to appear in your footer.', 'cactus' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer 2', 'cactus' ),
'id' => 'footer-2',
'description' => __( 'Add widgets here to appear in your footer.', 'cactus' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer 3', 'cactus' ),
'id' => 'footer-3',
'description' => __( 'Add widgets here to appear in your footer.', 'cactus' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer 4', 'cactus' ),
'id' => 'footer-4',
'description' => __( 'Add widgets here to appear in your footer.', 'cactus' ),
'before_widget' => '',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'cactus_widgets_init' );
/**
* Custom comments list
*/
function cactus_comment($comment, $args, $depth) {
?>
id="comment-">
comment_approved == '0') : ?>
';
$after = '';
if ( !is_home() && !is_front_page() || is_paged() ) {
echo '';
global $post;
$homeLink = esc_url(home_url());
echo '
' . __( 'Home' , 'cactus' ) . ' ' . $delimiter . ' ';
if ( is_category() ) {
global $wp_query;
$cat_obj = $wp_query->get_queried_object();
$thisCat = $cat_obj->term_id;
$thisCat = get_category($thisCat);
$parentCat = get_category($thisCat->parent);
if ($thisCat->parent != 0){
$cat_code = get_category_parents($parentCat, TRUE, ' ' . $delimiter . ' ');
echo $cat_code = str_replace ('
' . get_the_time('Y') . ' ' . $delimiter . ' ';
echo '
' . get_the_time('F') . ' ' . $delimiter . ' ';
echo $before . get_the_time('d') . $after;
} elseif ( is_month() ) {
echo '
' . get_the_time('Y') . ' ' . $delimiter . ' ';
echo $before . get_the_time('F') . $after;
} elseif ( is_year() ) {
echo $before . get_the_time('Y') . $after;
} elseif ( is_single() && !is_attachment() ) {
if ( get_post_type() != 'post' ) {
$post_type = get_post_type_object(get_post_type());
$slug = $post_type->rewrite;
echo '
' . $post_type->labels->singular_name . ' ' . $delimiter . ' ';
echo $before . get_the_title() . $after;
} else {
$cat = get_the_category(); $cat = $cat[0];
$cat_code = get_category_parents($cat, TRUE, ' ' . $delimiter . ' ');
echo $cat_code = str_replace ('
labels->singular_name . $after;
} elseif ( is_attachment() ) {
$parent = get_post($post->post_parent);
$cat = get_the_category($parent->ID); $cat = $cat[0];
echo '' . $parent->post_title . ' ' . $delimiter . ' ';
echo $before . get_the_title() . $after;
} elseif ( is_page() && !$post->post_parent ) {
echo $before . get_the_title() . $after;
} elseif ( is_page() && $post->post_parent ) {
$parent_id = $post->post_parent;
$breadcrumbs = array();
while ($parent_id) {
$page = get_page($parent_id);
$breadcrumbs[] = '
' . get_the_title($page->ID) . '';
$parent_id = $page->post_parent;
}
$breadcrumbs = array_reverse($breadcrumbs);
foreach ($breadcrumbs as $crumb) echo $crumb . ' ' . $delimiter . ' ';
echo $before . get_the_title() . $after;
} elseif ( is_search() ) {
echo $before ;
printf( __( 'Search Results for: %s', 'cactus' ), get_search_query() );
echo $after;
} elseif ( is_tag() ) {
echo $before ;
printf( __( 'Tag Archives: %s', 'cactus' ), single_tag_title( '', false ) );
echo $after;
} elseif ( is_author() ) {
global $author;
$userdata = get_userdata($author);
echo $before ;
printf( __( 'Author Archives: %s', 'cactus' ), $userdata->display_name );
echo $after;
} elseif ( is_404() ) {
echo $before;
_e( 'Not Found', 'cactus' );
echo $after;
}
if ( get_query_var('paged') ) {
if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() )
echo sprintf( __( '( Page %s )', 'cactus' ), get_query_var('paged') );
}
echo '
';
}
}
/**
* Get option
*/
function cactus_option($name){
global $cactus_options,$cactus_default_sections;
if( isset($cactus_options[$name]) )
return $cactus_options[$name];
elseif(isset($cactus_default_sections[$name]))
return $cactus_default_sections[$name];
else
return '';
}
function cactus_option_saved($name){
$cactus_options = get_option(CACTUS_TEXTDOMAIN);
if( isset($cactus_options[$name]) )
return $cactus_options[$name];
else
return '';
}
/**
* Do sections
*/
function cactus_do_sections(){
global $cactus_sections, $cactus_section_key;
$cactus_new_sections = array();
$section_order = cactus_option('section_order');
if($section_order !=''){
$my_sections = @json_decode($section_order,true);
if(is_array($my_sections)){
foreach($my_sections as $key){
if(isset($cactus_sections[$key]))
$cactus_new_sections[$key] = $cactus_sections[$key];
}
}
}
if(!empty($cactus_new_sections))
$cactus_sections = $cactus_new_sections;
if( $cactus_sections ){
foreach( $cactus_sections as $key=>$value){
$section_id = cactus_option('section_id_'.$key);
$section_hide = cactus_option('section_hide_'.$key);
$font_color = cactus_option('font_color_'.$key);
$background_parallax = cactus_option('background_parallax_'.$key);
$css_class = 'cactus-section cactus-section-'.$key;
if( $background_parallax == '1' ){
$css_class .= ' cactus-parallax';
}
if( $font_color == '1' ){
$css_class .= ' cactus-text-light';
}
$cactus_section_key = $key;
if( $section_hide != '1' ):
echo '';
do_action('cactus_before_section_'.$key);
get_template_part('sections/template',$key);
do_action('cactus_after_section_'.$key);
echo '
';
endif;
}
}
}
add_action('cactus_sections','cactus_do_sections');
/**
* Get sidebar
*/
function cactus_get_sidebar($layout,$type){
?>
';
}
$fb_output .= ''.__('How to create top menu','cactus').'';
$fb_output .= '
';
if ( $container )
$fb_output .= '' . $container . '>';
$allowed_html = array(
'a' => array( 'href' => array(), ),
'div' => array( 'id' => array(), 'class' => array(), ),
'ul' => array( 'class' => array() ),
'li' => array(),
);
echo wp_kses( $fb_output, $allowed_html );
}
}
/**
* Function to change sections order
*/
function cactus_reorder_section($cactus_sections) {
$cactus_new_sections = array();
$section_order = cactus_option_saved('section_order');
if($section_order !=''){
$my_sections = @json_decode($section_order,true);
if(is_array($my_sections)){
foreach($my_sections as $key){
if(isset($cactus_sections[$key]))
$cactus_new_sections[$key] = $cactus_sections[$key];
}
}
}
if(!empty($cactus_new_sections))
$cactus_sections = $cactus_new_sections;
return $cactus_sections;
}
add_filter( 'cactus_get_sections','cactus_reorder_section' );
/**
* Selective Refresh
*/
function cactus_register_partials( WP_Customize_Manager $wp_customize ) {
global $cactus_customizer_options;
$sections = cactus_get_sections();
// Abort if selective refresh is not available.
if ( ! isset( $wp_customize->selective_refresh ) ) {
return;
}
// Bail early if we don't have any options.
if ( empty( $cactus_customizer_options ) ) {
return;
}
// Loops through each of the options
/* foreach ( $cactus_customizer_options as $option ) {
if(isset($option['type']) && ($option['type'] == 'text' || $option['type'] == 'textarea' || $option['type'] == 'editor' || $option['type'] == 'image' || $option['type'] == 'repeater' ) ){
$wp_customize->selective_refresh->add_partial( $option['id'].'_selective', array(
'selector' => '.'.$option['id'].'_selective',
'settings' => array( CACTUS_TEXTDOMAIN.'['.$option['id'].']' ),
));
}
}*/
foreach($sections as $key => $value){
$wp_customize->selective_refresh->add_partial( 'section_title_'.$key.'_selective', array(
'selector' => '.section_title_'.$key.'_selective',
'settings' => array( 'cactus[section_title_'.$key.']' ),
'render_callback' => 'cactus_section_title_'.$key.'',
) );
$wp_customize->selective_refresh->add_partial( 'section_subtitle_'.$key.'_selective', array(
'selector' => '.section_subtitle_'.$key.'_selective',
'settings' => array( 'cactus[section_subtitle_'.$key.']' ),
'render_callback' => 'cactus_section_subtitle_'.$key.'',
) );
}
$wp_customize->selective_refresh->add_partial( 'text_promo_selective', array(
'selector' => '.text_promo_selective',
'settings' => array( 'cactus[text_promo]' ),
'render_callback' => 'cactus_text_promo',
) );
$wp_customize->selective_refresh->add_partial( 'button_text_promo_selective', array(
'selector' => '.button_text_promo_selective',
'settings' => array( 'cactus[button_text_promo]' ),
'render_callback' => 'cactus_button_text_promo',
) );
$wp_customize->selective_refresh->add_partial( 'address_contact_selective', array(
'selector' => '.address_contact_selective',
'settings' => array( 'cactus[address_contact]' ),
'render_callback' => 'cactus_address_contact',
) );
$wp_customize->selective_refresh->add_partial( 'email_contact_selective', array(
'selector' => '.email_contact_selective',
'settings' => array( 'cactus[email_contact]' ),
'render_callback' => 'cactus_email_contact',
) );
$wp_customize->selective_refresh->add_partial( 'tel_contact_selective', array(
'selector' => '.tel_contact_selective',
'settings' => array( 'cactus[tel_contact]' ),
'render_callback' => 'cactus_tel_contact',
) );
$wp_customize->selective_refresh->add_partial( 'button_text_news_selective', array(
'selector' => '.button_text_news_selective',
'settings' => array( 'cactus[button_text_news]' ),
'render_callback' => 'cactus_button_text_news',
) );
$wp_customize->selective_refresh->add_partial( 'button_text_call_to_action_selective', array(
'selector' => '.button_text_call_to_action_selective',
'settings' => array( 'cactus[button_text_call_to_action]' ),
'render_callback' => 'cactus_button_text_call_to_action',
) );
$wp_customize->selective_refresh->add_partial( 'copyright_selective', array(
'selector' => '.copyright_selective',
'settings' => array( 'cactus[copyright]' ),
'render_callback' => 'cactus_copyright',
) );
/*$wp_customize->selective_refresh->add_partial( 'image_contact_selective', array(
'selector' => '.image_contact_selective',
'settings' => array( 'cactus[image_contact]' ),
) );*/
$wp_customize->selective_refresh->add_partial( 'header_site_title', array(
'selector' => '.site-name',
'settings' => array( 'blogname' ),
'render_callback' => 'cactus_header_site_title',
) );
$wp_customize->selective_refresh->add_partial( 'header_site_description', array(
'selector' => '.site-tagline',
'settings' => array( 'blogdescription' ),
'render_callback' => 'cactus_header_site_descriptione',
) );
}
add_action( 'customize_register', 'cactus_register_partials' );
/* section service */
function cactus_section_title_service(){
$cactus_options = get_option(CACTUS_TEXTDOMAIN);
if( isset($cactus_options['section_title_service']) )
return $cactus_options['section_title_service'];
}
function cactus_section_subtitle_service(){
$cactus_options = get_option(CACTUS_TEXTDOMAIN);
if( isset($cactus_options['section_subtitle_service']) )
return $cactus_options['section_subtitle_service'];
}
/* section works */
function cactus_section_title_works(){
$cactus_options = get_option(CACTUS_TEXTDOMAIN);
if( isset($cactus_options['section_title_works']) )
return $cactus_options['section_title_works'];
}
function cactus_section_subtitle_works(){
$cactus_options = get_option(CACTUS_TEXTDOMAIN);
if( isset($cactus_options['section_subtitle_works']) )
return $cactus_options['section_subtitle_works'];
}
/* section promo */
function cactus_section_title_promo(){
$cactus_options = get_option(CACTUS_TEXTDOMAIN);
if( isset($cactus_options['section_title_promo']) )
return $cactus_options['section_title_promo'];
}
function cactus_section_subtitle_promo(){
$cactus_options = get_option(CACTUS_TEXTDOMAIN);
if( isset($cactus_options['section_subtitle_promo']) )
return $cactus_options['section_subtitle_promo'];
}
function cactus_text_promo(){
$cactus_options = get_option(CACTUS_TEXTDOMAIN);
if( isset($cactus_options['text_promo']) )
return $cactus_options['text_promo'];
}
function cactus_button_text_promo(){
$cactus_options = get_option(CACTUS_TEXTDOMAIN);
if( isset($cactus_options['button_text_promo']) )
return $cactus_options['button_text_promo'];
}
/* section team */
function cactus_section_title_team(){
$cactus_options = get_option(CACTUS_TEXTDOMAIN);
if( isset($cactus_options['section_title_team']) )
return $cactus_options['section_title_team'];
}
function cactus_section_subtitle_team(){
$cactus_options = get_option(CACTUS_TEXTDOMAIN);
if( isset($cactus_options['section_subtitle_team']) )
return $cactus_options['section_subtitle_team'];
}
/* section counter */
function cactus_section_title_counter(){
$cactus_options = get_option(CACTUS_TEXTDOMAIN);
if( isset($cactus_options['section_title_counter']) )
return $cactus_options['section_title_counter'];
}
function cactus_section_subtitle_counter(){
$cactus_options = get_option(CACTUS_TEXTDOMAIN);
if( isset($cactus_options['section_subtitle_counter']) )
return $cactus_options['section_subtitle_counter'];
}
/* section testimonial */
function cactus_section_title_testimonial(){
$cactus_options = get_option(CACTUS_TEXTDOMAIN);
if( isset($cactus_options['section_title_testimonial']) )
return $cactus_options['section_title_testimonial'];
}
function cactus_section_subtitle_testimonial(){
$cactus_options = get_option(CACTUS_TEXTDOMAIN);
if( isset($cactus_options['section_subtitle_testimonial']) )
return $cactus_options['section_subtitle_testimonial'];
}
/* section news */
function cactus_section_title_news(){
$cactus_options = get_option(CACTUS_TEXTDOMAIN);
if( isset($cactus_options['section_title_news']) )
return $cactus_options['section_title_news'];
}
function cactus_section_subtitle_news(){
$cactus_options = get_option(CACTUS_TEXTDOMAIN);
if( isset($cactus_options['section_subtitle_news']) )
return $cactus_options['section_subtitle_news'];
}
function cactus_button_text_news(){
$cactus_options = get_option(CACTUS_TEXTDOMAIN);
if( isset($cactus_options['button_text_news']) )
return $cactus_options['button_text_news'];
}
/* section contact */
function cactus_section_title_contact(){
$cactus_options = get_option(CACTUS_TEXTDOMAIN);
if( isset($cactus_options['section_title_contact']) )
return $cactus_options['section_title_contact'];
}
function cactus_section_subtitle_contact(){
$cactus_options = get_option(CACTUS_TEXTDOMAIN);
if( isset($cactus_options['section_subtitle_contact']) )
return $cactus_options['section_subtitle_contact'];
}
function cactus_address_contact(){
$cactus_options = get_option(CACTUS_TEXTDOMAIN);
if( isset($cactus_options['address_contact']) )
return $cactus_options['address_contact'];
}
function cactus_email_contact(){
$cactus_options = get_option(CACTUS_TEXTDOMAIN);
if( isset($cactus_options['email_contact']) )
return $cactus_options['email_contact'];
}
function cactus_tel_contact(){
$cactus_options = get_option(CACTUS_TEXTDOMAIN);
if( isset($cactus_options['tel_contact']) )
return $cactus_options['tel_contact'];
}
/* section pricing */
function cactus_section_title_pricing(){
$cactus_options = get_option(CACTUS_TEXTDOMAIN);
if( isset($cactus_options['section_title_pricing']) )
return $cactus_options['section_title_pricing'];
}
function cactus_section_subtitle_pricing(){
$cactus_options = get_option(CACTUS_TEXTDOMAIN);
if( isset($cactus_options['section_subtitle_pricing']) )
return $cactus_options['section_subtitle_pricing'];
}
/* section call_to_action */
function cactus_section_title_call_to_action(){
$cactus_options = get_option(CACTUS_TEXTDOMAIN);
if( isset($cactus_options['section_title_call_to_action']) )
return $cactus_options['section_title_call_to_action'];
}
function cactus_section_subtitle_call_to_action(){
$cactus_options = get_option(CACTUS_TEXTDOMAIN);
if( isset($cactus_options['section_subtitle_call_to_action']) )
return $cactus_options['section_subtitle_call_to_action'];
}
function cactus_button_text_call_to_action(){
$cactus_options = get_option(CACTUS_TEXTDOMAIN);
if( isset($cactus_options['button_text_call_to_action']) )
return $cactus_options['button_text_call_to_action'];
}
/* section subscribe */
function cactus_section_title_subscribe(){
$cactus_options = get_option(CACTUS_TEXTDOMAIN);
if( isset($cactus_options['section_title_subscribe']) )
return $cactus_options['section_title_subscribe'];
}
function cactus_section_subtitle_subscribe(){
$cactus_options = get_option(CACTUS_TEXTDOMAIN);
if( isset($cactus_options['section_subtitle_subscribe']) )
return $cactus_options['section_subtitle_subscribe'];
}
/* section video */
function cactus_section_title_video(){
$cactus_options = get_option(CACTUS_TEXTDOMAIN);
if( isset($cactus_options['section_title_video']) )
return $cactus_options['section_title_video'];
}
function cactus_section_subtitle_video(){
$cactus_options = get_option(CACTUS_TEXTDOMAIN);
if( isset($cactus_options['section_subtitle_video']) )
return $cactus_options['section_subtitle_video'];
}
/* footer */
function cactus_copyright(){
$cactus_options = get_option(CACTUS_TEXTDOMAIN);
if( isset($cactus_options['copyright']) )
return $cactus_options['copyright'];
}
//button_text_call_to_action
function cactus_header_site_title(){
return get_bloginfo( 'name' );
}
function cactus_header_site_descriptione(){
return get_bloginfo( 'description' );
}
function cactus_ajax_get_image_url(){
$id = $_POST['id'];
$image = $id;
if (is_numeric($id)) {
$image_attributes = wp_get_attachment_image_src($id, 'full');
$image = $image_attributes[0];
}
echo $image;
exit(0);
}
add_action('wp_ajax_cactus_ajax_get_image_url', 'cactus_ajax_get_image_url');
add_action('wp_ajax_nopriv_cactus_ajax_get_image_url', 'cactus_ajax_get_image_url');
/*
* Notifications in customize
*/
require get_template_directory() . '/inc/customizer-notify/class-cactus-customizer-notify.php';
$config_customizer = array(
'recommended_plugins' => array(
'cactus-companion' => array(
'recommended' => true,
'description' => sprintf( esc_html__( 'If you want to take full advantage of the options this theme has to offer, please install and activate %s.', 'cactus' ), sprintf( '%s', 'Cactus Companion' ) ),
),
),
'recommended_actions' => array(),
'recommended_actions_title' => esc_html__( 'Recommended Actions', 'cactus' ),
'recommended_plugins_title' => esc_html__( 'Recommended Plugins', 'cactus' ),
'install_button_label' => esc_html__( 'Install and Activate', 'cactus' ),
'activate_button_label' => esc_html__( 'Activate', 'cactus' ),
'deactivate_button_label' => esc_html__( 'Deactivate', 'cactus' ),
);
Cactus_Customizer_Notify::init( apply_filters( 'cactus_customizer_notify_array', $config_customizer ) );
/**
* Include the TGM_Plugin_Activation class.
*/
load_template( trailingslashit( get_template_directory() ) . 'inc/class-tgm-plugin-activation.php' );
add_action( 'tgmpa_register', 'cactus_theme_register_required_plugins' );
/**
* Register the required plugins for this theme.
*
*/
function cactus_theme_register_required_plugins() {
$plugins = array(
array(
'name' => __('Cactus Companion','cactus'), // The plugin name
'slug' => 'cactus-companion', // The plugin slug (typically the folder name)
'source' => esc_url('https://downloads.wordpress.org/plugin/cactus-companion.zip'), // The plugin source
'required' => false, // If false, the plugin is only 'recommended' instead of required
'version' => '1.0.0', // E.g. 1.0.0. If set, the active plugin must be this version or higher, otherwise a notice is presented
'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch
'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins
'external_url' => '', // If set, overrides default API URL and points to an external URL
),
);
/**
* Array of configuration settings. Amend each line as needed.
*/
$config = array(
'id' => 'cactus-companion', // Unique ID for hashing notices for multiple instances of TGMPA.
'default_path' => '', // Default absolute path to pre-packaged plugins.
'menu' => 'tgmpa-install-plugins', // Menu slug.
'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.
);
tgmpa( $plugins, $config );
}