init
This commit is contained in:
523
wp-content/themes/flatsome/inc/structure/structure-admin.php
Normal file
523
wp-content/themes/flatsome/inc/structure/structure-admin.php
Normal file
@@ -0,0 +1,523 @@
|
||||
<?php
|
||||
|
||||
/* Add Custom WP Editor CSS */
|
||||
|
||||
if(!function_exists('flatsome_editor_style')) {
|
||||
function flatsome_editor_style($url) {
|
||||
if ( !empty($url) )
|
||||
$url .= ',';
|
||||
// Change the path here if using sub-directory
|
||||
$url .= trailingslashit( get_template_directory_uri() ) . 'assets/css/editor.css';
|
||||
return $url;
|
||||
}
|
||||
}
|
||||
add_filter('mce_css', 'flatsome_editor_style');
|
||||
|
||||
|
||||
/* Extra Editor Styles (add extra styles to the content editor box) */
|
||||
if(!function_exists('flatsome_mce_buttons_2')) {
|
||||
function flatsome_mce_buttons_2( $buttons ) {
|
||||
array_unshift( $buttons, 'styleselect' );
|
||||
return $buttons;
|
||||
}
|
||||
}
|
||||
add_filter( 'mce_buttons', 'flatsome_mce_buttons_2' );
|
||||
|
||||
|
||||
// Customize mce editor font sizes
|
||||
if ( ! function_exists( 'flatsome_editor_text_sizes' ) ) {
|
||||
function flatsome_editor_text_sizes( $initArray ){
|
||||
$initArray['fontsize_formats'] = "75% 80% 85% 90% 95% 100% 105% 110% 115% 120% 130% 140% 150% 160% 170% 180% 190% 200% 250% 300% 350% 400% 450% 500%";
|
||||
return $initArray;
|
||||
}
|
||||
}
|
||||
add_filter( 'tiny_mce_before_init', 'flatsome_editor_text_sizes' );
|
||||
|
||||
|
||||
// Enable font size & font family selects in the editor
|
||||
if ( ! function_exists( 'flatsome_font_buttons' ) ) {
|
||||
function flatsome_font_buttons( $buttons ) {
|
||||
//array_splice( $buttons, 2, 0, 'fontselect' ); // Add Font Select
|
||||
array_splice( $buttons, 5, 0, 'backcolor' ); // Add Font Size Select
|
||||
array_splice( $buttons, 2, 0, 'fontsizeselect' ); // Add Font Size Select
|
||||
return $buttons;
|
||||
}
|
||||
}
|
||||
add_filter( 'mce_buttons_2', 'flatsome_font_buttons');
|
||||
|
||||
|
||||
function flatsome_formats_before_init( $settings ) {
|
||||
|
||||
$style_formats = array(
|
||||
|
||||
array(
|
||||
'title' => 'Link styles',
|
||||
'selector' => 'a',
|
||||
'items' => array(
|
||||
array(
|
||||
'title' => 'Button Primary',
|
||||
'selector' => 'a',
|
||||
'classes' => 'button primary',
|
||||
),
|
||||
array(
|
||||
'title' => 'Button White',
|
||||
'selector' => 'a',
|
||||
'classes' => 'button white',
|
||||
),
|
||||
array(
|
||||
'title' => 'Button Secondary',
|
||||
'selector' => 'a',
|
||||
'classes' => 'button secondary',
|
||||
|
||||
),
|
||||
array(
|
||||
'title' => 'Button Alert',
|
||||
'selector' => 'a',
|
||||
'classes' => 'button alert',
|
||||
|
||||
),
|
||||
array(
|
||||
'title' => 'Button Success',
|
||||
'selector' => 'a',
|
||||
'classes' => 'button success',
|
||||
|
||||
),
|
||||
array(
|
||||
'title' => 'Button Alternative Primary',
|
||||
'selector' => 'a',
|
||||
'classes' => 'button is-outline',
|
||||
|
||||
),
|
||||
array(
|
||||
'title' => 'Button Alternative White',
|
||||
'selector' => 'a',
|
||||
'classes' => 'button is-outline white',
|
||||
|
||||
),
|
||||
array(
|
||||
'title' => 'Large - Button Primary',
|
||||
'selector' => 'a',
|
||||
'classes' => 'button large primary',
|
||||
),
|
||||
array(
|
||||
'title' => 'Large Button Secondary',
|
||||
'selector' => 'a',
|
||||
'classes' => 'button large secondary',
|
||||
|
||||
),
|
||||
array(
|
||||
'title' => 'Large Button Alert',
|
||||
'selector' => 'a',
|
||||
'classes' => 'button large alert',
|
||||
|
||||
),
|
||||
array(
|
||||
'title' => 'Large Button Success',
|
||||
'selector' => 'a',
|
||||
'classes' => 'button large success',
|
||||
|
||||
),
|
||||
array(
|
||||
'title' => 'Large Button Alternative Primary',
|
||||
'selector' => 'a',
|
||||
'classes' => 'button large is-outline success',
|
||||
|
||||
),
|
||||
array(
|
||||
'title' => 'Large Button Alternative Secondary',
|
||||
'selector' => 'a',
|
||||
'classes' => 'button large is-outline secondary',
|
||||
|
||||
),
|
||||
array(
|
||||
'title' => 'Large Button Alternative White',
|
||||
'selector' => 'a',
|
||||
'classes' => 'button large is-outline white',
|
||||
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'title' => 'Animations',
|
||||
'items' => array(
|
||||
array(
|
||||
'title' => 'None',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p,a,span',
|
||||
'attributes' => array('data-animate' => ''),
|
||||
),
|
||||
array(
|
||||
'title' => 'Fade In',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p,a,span',
|
||||
'attributes' => array('data-animate' => 'fadeIn'),
|
||||
),
|
||||
array(
|
||||
'title' => 'Fade In Left',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p,a,span',
|
||||
'attributes' => array('data-animate' => 'fadeInLeft'),
|
||||
),
|
||||
array(
|
||||
'title' => 'Fade In Right',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p,a,span',
|
||||
'attributes' => array('data-animate' => 'fadeInRight'),
|
||||
),
|
||||
array(
|
||||
'title' => 'Fade In Up',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p,a,span',
|
||||
'attributes' => array('data-animate' => 'fadeInUp'),
|
||||
),
|
||||
)
|
||||
),
|
||||
array(
|
||||
'title' => 'Animations - Delay',
|
||||
'items' => array(
|
||||
array(
|
||||
'title' => 'Default',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p,a',
|
||||
'attributes' => array('data-animate-delay' => ''),
|
||||
),
|
||||
array(
|
||||
'title' => '.1s',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p,a',
|
||||
'attributes' => array('data-animate-delay' => '200'),
|
||||
),
|
||||
array(
|
||||
'title' => '.2s',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p,a',
|
||||
'attributes' => array('data-animate-delay' => '200'),
|
||||
),
|
||||
array(
|
||||
'title' => '.3s',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p,a',
|
||||
'attributes' => array('data-animate-delay' => '300'),
|
||||
),
|
||||
array(
|
||||
'title' => '.4s',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p,a',
|
||||
'attributes' => array('data-animate-delay' => '400'),
|
||||
),
|
||||
array(
|
||||
'title' => '.5s',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p,a',
|
||||
'attributes' => array('data-animate-delay' => '500'),
|
||||
),
|
||||
array(
|
||||
'title' => '.6s',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p,a',
|
||||
'attributes' => array('data-animate-delay' => '600'),
|
||||
),
|
||||
array(
|
||||
'title' => '.7s',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p,a',
|
||||
'attributes' => array('data-animate-delay' => '700'),
|
||||
),
|
||||
array(
|
||||
'title' => '.8s',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p,a',
|
||||
'attributes' => array('data-animate-delay' => '800'),
|
||||
),
|
||||
array(
|
||||
'title' => '.9s',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p,a',
|
||||
'attributes' => array('data-animate-delay' => '900'),
|
||||
),
|
||||
array(
|
||||
'title' => '1s',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p,a',
|
||||
'attributes' => array('data-animate-delay' => '1000'),
|
||||
),
|
||||
)
|
||||
),
|
||||
array(
|
||||
'title' => 'Visibility',
|
||||
'items' => array(
|
||||
array(
|
||||
'title' => 'Show for All',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p',
|
||||
'attributes' => array('data-show' => ''),
|
||||
),
|
||||
array(
|
||||
'title' => 'Hide for Mobile',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p',
|
||||
'attributes' => array('data-show' => 'hide-for-small'),
|
||||
),
|
||||
array(
|
||||
'title' => 'Hide for Tablet',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p',
|
||||
'attributes' => array('data-show' => 'hide-for-medium'),
|
||||
),
|
||||
array(
|
||||
'title' => 'Show only on Mobile',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p',
|
||||
'attributes' => array('data-show' => 'show-for-small'),
|
||||
),
|
||||
array(
|
||||
'title' => 'Show only on Tablet',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p',
|
||||
'attributes' => array('data-show' => 'show-for-medium'),
|
||||
),
|
||||
)
|
||||
),
|
||||
array(
|
||||
'title' => 'Opacity',
|
||||
'items' => array(
|
||||
array(
|
||||
'title' => '1',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p,a',
|
||||
'attributes' => array('data-opacity' => ''),
|
||||
),
|
||||
array(
|
||||
'title' => '0.9',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p,a',
|
||||
'attributes' => array('data-opacity' => '0.9'),
|
||||
),
|
||||
array(
|
||||
'title' => '0.8',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p,a',
|
||||
'attributes' => array('data-opacity' => '0.8'),
|
||||
),
|
||||
array(
|
||||
'title' => '0.7',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p,a',
|
||||
'attributes' => array('data-opacity' => '0.7'),
|
||||
),
|
||||
array(
|
||||
'title' => '0.6',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p,a',
|
||||
'attributes' => array('data-opacity' => '0.6'),
|
||||
),
|
||||
array(
|
||||
'title' => '0.5',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p,a',
|
||||
'attributes' => array('data-opacity' => '0.5'),
|
||||
),
|
||||
)
|
||||
),
|
||||
array(
|
||||
'title' => 'Line Height',
|
||||
'items' => array(
|
||||
array(
|
||||
'title' => 'Default',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p,a,span',
|
||||
'attributes' => array('data-line-height' => ''),
|
||||
),
|
||||
array(
|
||||
'title' => 'X-Small',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p,a,span',
|
||||
'attributes' => array('data-line-height' => 'xs'),
|
||||
),
|
||||
array(
|
||||
'title' => 'Small',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p,a,span',
|
||||
'attributes' => array('data-line-height' => 's'),
|
||||
),
|
||||
array(
|
||||
'title' => 'Medium',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p,a,span',
|
||||
'attributes' => array('data-line-height' => 'm'),
|
||||
),
|
||||
array(
|
||||
'title' => 'Large',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p,a,span',
|
||||
'attributes' => array('data-line-height' => 'l'),
|
||||
),
|
||||
array(
|
||||
'title' => 'X Large',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p,a,span',
|
||||
'attributes' => array('data-line-height' => 'xl'),
|
||||
),
|
||||
)
|
||||
),
|
||||
array(
|
||||
'title' => 'Padding',
|
||||
'items' => array(
|
||||
array(
|
||||
'title' => '5px',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p,a',
|
||||
'attributes' => array('data-padding' => '5px'),
|
||||
),
|
||||
array(
|
||||
'title' => '10px',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p,a',
|
||||
'attributes' => array('data-padding' => '10px'),
|
||||
),
|
||||
array(
|
||||
'title' => '15px',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p,a',
|
||||
'attributes' => array('data-padding' => '15px'),
|
||||
), array(
|
||||
'title' => '20px',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p,a',
|
||||
'attributes' => array('data-padding' => '20px'),
|
||||
),
|
||||
array(
|
||||
'title' => '30px',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p,a',
|
||||
'attributes' => array('data-padding' => '30px'),
|
||||
),
|
||||
array(
|
||||
'title' => '40px',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p,a',
|
||||
'attributes' => array('data-padding' => '40px'),
|
||||
),
|
||||
)
|
||||
),
|
||||
array(
|
||||
'title' => 'Text Color',
|
||||
'items' => array(
|
||||
array(
|
||||
'title' => 'None',
|
||||
'inline' => 'span',
|
||||
'attributes' => array('data-text-color' => ''),
|
||||
),
|
||||
array(
|
||||
'title' => 'Primary Color',
|
||||
'inline' => 'span',
|
||||
'attributes' => array('data-text-color' => 'primary'),
|
||||
),
|
||||
array(
|
||||
'title' => 'Secondary Color',
|
||||
'inline' => 'span',
|
||||
'attributes' => array('data-text-color' => 'secondary'),
|
||||
),
|
||||
array(
|
||||
'title' => 'Alert Color',
|
||||
'inline' => 'span',
|
||||
'attributes' => array('data-text-color' => 'alert'),
|
||||
), array(
|
||||
'title' => 'Success Color',
|
||||
'inline' => 'span',
|
||||
'attributes' => array('data-text-color' => 'success'),
|
||||
),
|
||||
)
|
||||
),
|
||||
array(
|
||||
'title' => 'Text Background',
|
||||
'items' => array(
|
||||
array(
|
||||
'title' => 'Primary BG Color',
|
||||
'inline' => 'span',
|
||||
'attributes' => array('data-text-bg' => 'primary'),
|
||||
),
|
||||
array(
|
||||
'title' => 'Secondary BG Color',
|
||||
'inline' => 'span',
|
||||
'attributes' => array('data-text-bg' => 'secondary'),
|
||||
),
|
||||
array(
|
||||
'title' => 'Alert BG Color',
|
||||
'inline' => 'span',
|
||||
'attributes' => array('data-text-bg' => 'alert'),
|
||||
), array(
|
||||
'title' => 'Success BG Color',
|
||||
'inline' => 'span',
|
||||
'attributes' => array('data-text-bg' => 'success'),
|
||||
),
|
||||
)
|
||||
),
|
||||
array(
|
||||
'title' => 'List Styles',
|
||||
'items' => array(
|
||||
array(
|
||||
'title' => 'Bullets List - Check mark',
|
||||
'selector' => 'li',
|
||||
'classes' => 'bullet-checkmark',
|
||||
|
||||
),
|
||||
array(
|
||||
'title' => 'Bullets List - Arrow',
|
||||
'selector' => 'li',
|
||||
'classes' => 'bullet-arrow',
|
||||
|
||||
),
|
||||
array(
|
||||
'title' => 'Bullets List - Star',
|
||||
'selector' => 'li',
|
||||
'classes' => 'bullet-star',
|
||||
),
|
||||
|
||||
)
|
||||
),
|
||||
array(
|
||||
'title' => 'Lead Text (p)',
|
||||
'block' => 'p',
|
||||
'classes' => 'lead',
|
||||
'exact' => true,
|
||||
),
|
||||
array(
|
||||
'title' => 'Count Up Number',
|
||||
'inline' => 'span',
|
||||
'classes' => 'count-up',
|
||||
'exact' => true,
|
||||
),
|
||||
array(
|
||||
'title' => 'Uppercase',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p,a',
|
||||
'classes' => 'uppercase',
|
||||
'exact' => true,
|
||||
),
|
||||
array(
|
||||
'title' => 'Fancy Underline',
|
||||
'inline' => 'span',
|
||||
'classes' => 'fancy-underline',
|
||||
'exact' => true,
|
||||
),
|
||||
array(
|
||||
'title' => 'Thin Font',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p,a',
|
||||
'classes' => 'thin-font',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => 'Alternative Font',
|
||||
'selector' => 'h1,h2,h3,h4,h5,h6,p,a',
|
||||
'classes' => 'alt-font',
|
||||
),
|
||||
);
|
||||
|
||||
$style_formats = apply_filters( 'flatsome_text_formats', $style_formats );
|
||||
$settings['style_formats'] = json_encode( $style_formats );
|
||||
|
||||
return $settings;
|
||||
|
||||
}
|
||||
add_filter( 'tiny_mce_before_init', 'flatsome_formats_before_init' );
|
||||
|
||||
|
||||
/* Extra Editor Colors */
|
||||
if ( ! function_exists( 'flatsome_text_colors' ) ) {
|
||||
function flatsome_text_colors( $init ) {
|
||||
global $flatsome_opt;
|
||||
$default_colours = '
|
||||
"000000", "Black", "993300", "Burnt orange", "333300", "Dark olive", "003300", "Dark green", "003366", "Dark azure", "000080", "Navy Blue", "333399", "Indigo", "333333", "Very dark gray",
|
||||
"800000", "Maroon", "FF6600", "Orange", "808000", "Olive", "008000", "Green", "008080", "Teal", "0000FF", "Blue", "666699", "Grayish blue", "808080", "Gray",
|
||||
"FF0000", "Red", "FF9900", "Amber", "99CC00", "Yellow green", "339966", "Sea green", "33CCCC", "Turquoise", "3366FF", "Royal blue", "800080", "Purple", "999999", "Medium gray",
|
||||
"FF00FF", "Magenta", "FFCC00", "Gold", "FFFF00", "Yellow", "00FF00", "Lime", "00FFFF", "Aqua", "00CCFF", "Sky blue", "993366", "Brown", "C0C0C0", "Silver",
|
||||
"FF99CC", "Pink", "FFCC99", "Peach", "FFFF99", "Light yellow", "CCFFCC", "Pale green", "CCFFFF", "Pale cyan", "99CCFF", "Light sky blue", "CC99FF", "Plum", "FFFFFF", "White"
|
||||
';
|
||||
$custom_colours = '
|
||||
"e14d43", "Primary Color", "d83131", "Color 2 Name", "ed1c24", "Color 3 Name", "f99b1c", "Color 4 Name", "50b848", "Color 5 Name", "00a859", "Color 6 Name", "00aae7", "Color 7 Name", "282828", "Color 8 Name"
|
||||
';
|
||||
$init['textcolor_map'] = '['.$custom_colours.','.$default_colours.']';
|
||||
return $init;
|
||||
}
|
||||
}
|
||||
add_filter('tiny_mce_before_init', 'flatsome_text_colors');
|
||||
|
||||
|
||||
/* Enable SVG upload */
|
||||
function flatsome_enable_svg( $mimes ){
|
||||
// enable svg for super users.
|
||||
if(current_user_can('manage_options')){
|
||||
$mimes['svg'] = 'image/svg+xml';
|
||||
}
|
||||
return $mimes;
|
||||
}
|
||||
add_filter( 'upload_mimes', 'flatsome_enable_svg' );
|
||||
|
||||
|
||||
function flatsome_enable_font_upload( $mimes ){
|
||||
$mimes['ttf'] = 'application/octet-stream';
|
||||
$mimes['otf'] = 'font/opentype';
|
||||
return $mimes;
|
||||
}
|
||||
add_filter( 'upload_mimes', 'flatsome_enable_font_upload' );
|
138
wp-content/themes/flatsome/inc/structure/structure-footer.php
Normal file
138
wp-content/themes/flatsome/inc/structure/structure-footer.php
Normal file
@@ -0,0 +1,138 @@
|
||||
<?php
|
||||
|
||||
// Get Mobile Sidebar Menu
|
||||
function flatsome_mobile_menu(){
|
||||
get_template_part('template-parts/overlays/overlay','menu');
|
||||
}
|
||||
add_action('wp_footer', 'flatsome_mobile_menu', 7);
|
||||
|
||||
|
||||
function flatsome_footer_row_style($footer){
|
||||
$classes = array('row');
|
||||
if($footer == 'footer-1'){
|
||||
$columns = get_theme_mod('footer_1_columns', 4);
|
||||
|
||||
if($columns == 'large-3'){
|
||||
$columns = '4';
|
||||
}
|
||||
if($columns == 'large-2'){
|
||||
$columns = '6';
|
||||
}
|
||||
if($columns == 'large-12'){
|
||||
$columns = '1';
|
||||
}
|
||||
if($columns == 'large-4'){
|
||||
$columns = '3';
|
||||
}
|
||||
|
||||
if(get_theme_mod('footer_1_color') == 'dark') $classes[] = 'dark';
|
||||
$classes[] = 'large-columns-'.$columns;
|
||||
}
|
||||
if($footer == 'footer-2'){
|
||||
$columns = get_theme_mod('footer_2_columns', 4);
|
||||
if($columns == 'large-3'){
|
||||
$columns = '4';
|
||||
}
|
||||
if($columns == 'large-2'){
|
||||
$columns = '6';
|
||||
}
|
||||
if($columns == 'large-12'){
|
||||
$columns = '1';
|
||||
}
|
||||
if($columns == 'large-4'){
|
||||
$columns = '3';
|
||||
}
|
||||
if(get_theme_mod('footer_2_color', 'dark') == 'dark') $classes[] = 'dark';
|
||||
$classes[] = 'large-columns-'.$columns;
|
||||
}
|
||||
|
||||
return implode(' ', $classes);
|
||||
}
|
||||
|
||||
function flatsome_page_footer(){
|
||||
$block = get_theme_mod( 'footer_block' );
|
||||
|
||||
if ( is_page() ) {
|
||||
// Custom Page footers.
|
||||
$page_footer = get_post_meta( get_the_ID(), '_footer', true );
|
||||
$default = empty( $page_footer ) || $page_footer == 'normal';
|
||||
|
||||
if ( $page_footer !== 'disabled' ) {
|
||||
if ( ! $block ) {
|
||||
if ( $default ) {
|
||||
get_template_part( 'template-parts/footer/footer' );
|
||||
} elseif ( ! empty( $page_footer ) ) {
|
||||
get_template_part( 'template-parts/footer/footer', $page_footer );
|
||||
}
|
||||
} else {
|
||||
echo do_shortcode( '[block id="' . $block . '"]' );
|
||||
get_template_part( 'template-parts/footer/footer-absolute' );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Global footer.
|
||||
if ( $block ) {
|
||||
echo do_shortcode( '[block id="' . $block . '"]' );
|
||||
get_template_part( 'template-parts/footer/footer-absolute' );
|
||||
} else {
|
||||
get_template_part( 'template-parts/footer/footer' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'flatsome_footer', 'flatsome_page_footer', 10 );
|
||||
|
||||
|
||||
// Add Top Link
|
||||
function flatsome_go_to_top(){
|
||||
if(!get_theme_mod('back_to_top', 1)) return;
|
||||
get_template_part('template-parts/footer/back-to-top');
|
||||
}
|
||||
add_action( 'flatsome_footer', 'flatsome_go_to_top');
|
||||
|
||||
|
||||
/* Custom footer scripts */
|
||||
function flatsome_footer_scripts(){
|
||||
echo do_shortcode(get_theme_mod('html_scripts_footer'));
|
||||
}
|
||||
add_action('wp_footer', 'flatsome_footer_scripts');
|
||||
|
||||
/* Insert custom body bottom script */
|
||||
function flatsome_before_body_close() {
|
||||
if ( get_theme_mod( 'html_scripts_before_body' ) && ! is_admin() ) {
|
||||
echo get_theme_mod( 'html_scripts_before_body' ); // WPCS: XSS ok.
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'wp_footer', 'flatsome_before_body_close', apply_filters( 'flatsome_before_body_close_priority', 9999 ) );
|
||||
|
||||
/**
|
||||
* Adds body-overlay element if enabled for one of the header positions.
|
||||
*/
|
||||
function flatsome_body_overlay() {
|
||||
if ( get_theme_mod( 'nav_top_body_overlay' ) || get_theme_mod( 'nav_body_overlay' ) || get_theme_mod( 'nav_bottom_body_overlay' ) ) {
|
||||
echo '<div class="ux-body-overlay"></div>';
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'wp_footer', 'flatsome_body_overlay' );
|
||||
|
||||
|
||||
// Custom HTML Before footer
|
||||
function flatsome_html_before_footer(){
|
||||
$html_before = get_theme_mod('html_before_footer');
|
||||
if($html_before){
|
||||
echo do_shortcode($html_before);
|
||||
}
|
||||
}
|
||||
add_action('flatsome_before_footer', 'flatsome_html_before_footer');
|
||||
|
||||
// Custom HMTL After footer
|
||||
function flatsome_html_after_footer(){
|
||||
$html_after = get_theme_mod('html_after_footer');
|
||||
if($html_after){
|
||||
echo do_shortcode($html_after);
|
||||
}
|
||||
}
|
||||
add_action('flatsome_after_footer', 'flatsome_html_after_footer');
|
||||
|
1210
wp-content/themes/flatsome/inc/structure/structure-header.php
Normal file
1210
wp-content/themes/flatsome/inc/structure/structure-header.php
Normal file
File diff suppressed because it is too large
Load Diff
144
wp-content/themes/flatsome/inc/structure/structure-pages.php
Normal file
144
wp-content/themes/flatsome/inc/structure/structure-pages.php
Normal file
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
/**
|
||||
* Flatsome Structure
|
||||
*
|
||||
* Page Structure.
|
||||
*
|
||||
* @package Flatsome\Structures
|
||||
*/
|
||||
|
||||
/**
|
||||
* Adds page excerpt to top if exists.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function flatsome_page_top_excerpt() {
|
||||
if ( get_theme_mod( 'page_top_excerpt', 1 ) && has_excerpt() ) { ?>
|
||||
<div class="page-header-excerpt">
|
||||
<?php the_excerpt(); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
add_action( 'flatsome_before_page', 'flatsome_page_top_excerpt', 20 );
|
||||
|
||||
/**
|
||||
* Adds opening wrappers to the password protection form if page is password protected.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function flatsome_page_passord_required_top() {
|
||||
if ( post_password_required() ) echo '<div class="page-title"></div><div class="container password-required">';
|
||||
}
|
||||
add_action( 'flatsome_before_page', 'flatsome_page_passord_required_top', -99 );
|
||||
|
||||
/**
|
||||
* Adds closing wrappers to the password protection form if page is password protected.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function flatsome_page_passord_required_bottom() {
|
||||
if ( post_password_required() ) echo '</div>';
|
||||
}
|
||||
add_action( 'flatsome_after_page', 'flatsome_page_passord_required_bottom', 99 );
|
||||
|
||||
/**
|
||||
* Adds classes to Pages.
|
||||
*
|
||||
* @param array $classes Classes.
|
||||
* @return array.
|
||||
*/
|
||||
function flatsome_page_header_options( $classes ) {
|
||||
|
||||
// Header classes for pages.
|
||||
if ( is_page() ) {
|
||||
|
||||
$page_template = get_post_meta( get_the_ID(), '_wp_page_template', true );
|
||||
|
||||
// Get default page template.
|
||||
if ( get_theme_mod( 'pages_template', 'default' ) !== 'blank' && $page_template == 'default' || empty( $page_template ) ) {
|
||||
$page_template = get_theme_mod( 'pages_template', 'default' );
|
||||
}
|
||||
|
||||
// Set header classes.
|
||||
if ( ! empty( $page_template ) ) {
|
||||
|
||||
if ( strpos( $page_template, 'transparent' ) !== false ) {
|
||||
$classes[] = 'transparent has-transparent';
|
||||
}
|
||||
|
||||
if ( strpos( $page_template, 'header-on-scroll' ) !== false ) {
|
||||
$classes[] = 'show-on-scroll';
|
||||
}
|
||||
}
|
||||
}
|
||||
return $classes;
|
||||
}
|
||||
add_filter( 'flatsome_header_class', 'flatsome_page_header_options', 10 );
|
||||
|
||||
/**
|
||||
* Pages SubNav.
|
||||
*
|
||||
* @global object $post Post object (WP_Post).
|
||||
*
|
||||
* @param string $style Page style.
|
||||
* @param string $string HTML codes of SubNav.
|
||||
* @return void.
|
||||
*/
|
||||
function get_flatsome_subnav( $style = '', $string = '' ) {
|
||||
if ( is_page() ) {
|
||||
global $post;
|
||||
if ( is_page() && $post->post_parent )
|
||||
$childpages = wp_list_pages( 'sort_column=menu_order&title_li=&child_of=' . $post->post_parent . '&echo=0' );
|
||||
else $childpages = wp_list_pages( 'sort_column=menu_order&title_li=&child_of=' . $post->ID . '&echo=0' );
|
||||
if ( $childpages ) {
|
||||
|
||||
// Add active class.
|
||||
$childpages = str_replace( 'current_page_item', 'current_page_item active', $childpages );
|
||||
$string = '<ul class="nav ' . $style . '">' . $childpages . '</ul>';
|
||||
}
|
||||
|
||||
echo $string; // phpcs:ignore
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the HTML output of individual page number links.
|
||||
*
|
||||
* @param string $link The page number HTML output.
|
||||
* @param int $i Page number for paginated posts' page links.
|
||||
*
|
||||
* @return string Modified HTML output.
|
||||
*/
|
||||
function flatsome_wp_link_pages_link( $link, $i ) {
|
||||
return '<li>' . $link . '</li>';
|
||||
}
|
||||
|
||||
add_filter( 'wp_link_pages_link', 'flatsome_wp_link_pages_link', 10, 2 );
|
||||
|
||||
/**
|
||||
* Filters the arguments used in retrieving page links for paginated posts.
|
||||
*
|
||||
* @param array $params An array of arguments for page links for paginated posts.
|
||||
*
|
||||
* @return array Modified parameters.
|
||||
*/
|
||||
function flatsome_wp_link_pages_args( $params ) {
|
||||
$params['before'] = '<div class="page-links"><ul class="page-numbers nav-pagination links text-center pb">';
|
||||
$params['after'] = '</ul></div>';
|
||||
|
||||
return $params;
|
||||
}
|
||||
|
||||
add_filter( 'wp_link_pages_args', 'flatsome_wp_link_pages_args' );
|
||||
|
||||
/**
|
||||
* The formatted output of a list of pages.
|
||||
* Displays page links for paginated pages with <!--nextpage-->
|
||||
*/
|
||||
function flatsome_wp_link_pages() {
|
||||
wp_link_pages();
|
||||
}
|
||||
|
||||
add_action( 'flatsome_after_page', 'flatsome_wp_link_pages' );
|
||||
|
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
// Add Transparent Header if set
|
||||
function flatsome_portfolio_header_classes($classes){
|
||||
// Add transparent header to product page if set.
|
||||
if(is_singular( 'featured_item' ) && flatsome_option('portfolio_title_transparent')){
|
||||
$classes[] = 'transparent has-transparent nav-dark toggle-nav-dark';
|
||||
}
|
||||
|
||||
$trans = flatsome_option('portfolio_archive_title_transparent');
|
||||
if(is_page_template( 'page-featured-items-4col.php' ) && $trans || is_page_template( 'page-featured-items-3col.php' ) && $trans || is_tax('featured_item_category') && $trans){
|
||||
$classes[] = 'transparent has-transparent nav-dark toggle-nav-dark';
|
||||
}
|
||||
return $classes;
|
||||
}
|
||||
|
||||
add_filter('flatsome_header_class','flatsome_portfolio_header_classes', 10);
|
||||
|
||||
|
||||
|
||||
function flatsome_next_post_link_portfolio() {
|
||||
global $post;
|
||||
$next_post = get_next_post(true,'','featured_item_category');
|
||||
if ( is_a( $next_post , 'WP_Post' ) ) { ?>
|
||||
<a title="<?php echo get_the_title( $next_post->ID ); ?>" class="prev-link plain" href="<?php echo get_the_permalink( $next_post->ID ); ?>">
|
||||
<?php echo get_the_title($next_post->ID);?>
|
||||
<?php echo get_flatsome_icon('icon-angle-right');?>
|
||||
</a>
|
||||
<?php }
|
||||
}
|
||||
|
||||
function flatsome_previous_post_link_portfolio() {
|
||||
global $post;
|
||||
$prev_post = get_previous_post(true,'','featured_item_category');
|
||||
if ( is_a( $prev_post , 'WP_Post' ) ) { ?>
|
||||
|
||||
<a title="<?php echo get_the_title( $prev_post->ID ); ?>" class="next-link plain" href="<?php echo get_the_permalink( $prev_post->ID ); ?>">
|
||||
<?php echo get_flatsome_icon('icon-angle-left');?>
|
||||
<?php echo get_the_title($prev_post->ID);?>
|
||||
</a>
|
||||
|
||||
<?php }
|
||||
}
|
||||
|
||||
function get_flatsome_portfolio_breadcrumbs(){
|
||||
global $page;
|
||||
echo '<div class="breadcrumbs"><a href="';
|
||||
echo get_option('home');
|
||||
echo '">';
|
||||
echo _x( 'Home', 'breadcrumb', 'flatsome' );
|
||||
echo "</a>";
|
||||
echo "<span class='divider'>/</span>";
|
||||
if(flatsome_option('featured_items_page') && !is_page()){
|
||||
$page_parent = get_page_by_path(flatsome_option('featured_items_page'));
|
||||
echo '<a href="'.get_the_permalink($page_parent->ID).'">'.get_the_title($page_parent->ID).'</a>';
|
||||
echo "<span class='divider'>/</span>";
|
||||
}
|
||||
if(is_single()){
|
||||
echo get_the_term_list( get_the_ID(), 'featured_item_category', '', '<span class="divider">-</span>', '' );
|
||||
}
|
||||
// Current page
|
||||
if(is_tax()){
|
||||
$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
|
||||
echo $term->name;
|
||||
} else if(is_page()) {
|
||||
echo get_the_title();
|
||||
}
|
||||
echo "</div>";
|
||||
}
|
315
wp-content/themes/flatsome/inc/structure/structure-posts.php
Normal file
315
wp-content/themes/flatsome/inc/structure/structure-posts.php
Normal file
@@ -0,0 +1,315 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Remove recent comments style
|
||||
*/
|
||||
function flatsome_remove_recent_comments_style() {
|
||||
add_filter( 'show_recent_comments_widget_style', '__return_false' );
|
||||
}
|
||||
|
||||
add_action( 'widgets_init', 'flatsome_remove_recent_comments_style' );
|
||||
|
||||
/**
|
||||
* Apply custom post excerpt suffix based on user setting.
|
||||
*/
|
||||
function flatsome_excerpt_suffix() {
|
||||
return get_theme_mod( 'blog_excerpt_suffix', ' [...]' );
|
||||
}
|
||||
add_filter( 'excerpt_more', 'flatsome_excerpt_suffix' );
|
||||
|
||||
|
||||
// Blog Article Classes
|
||||
function flatsome_blog_article_classes() {
|
||||
$classes = array();
|
||||
if ( get_theme_mod( 'blog_posts_depth', 0 ) ) $classes[] = 'has-shadow box-shadow-' . get_theme_mod( 'blog_posts_depth', 0 );
|
||||
if ( get_theme_mod( 'blog_posts_depth_hover', 0 ) ) $classes[] = 'box-shadow-' . get_theme_mod( 'blog_posts_depth_hover', 0 ) . '-hover';
|
||||
if ( ! empty( $classes ) ) echo implode( ' ', $classes );
|
||||
}
|
||||
|
||||
// Add Custom Blog Header
|
||||
function flatsome_custom_blog_header() {
|
||||
if ( get_theme_mod( 'blog_header' ) && is_home() ) {
|
||||
echo '<div class="blog-header-wrapper">' . do_shortcode( get_theme_mod( 'blog_header' ) ) . '</div>';
|
||||
}
|
||||
}
|
||||
add_action( 'flatsome_after_header', 'flatsome_custom_blog_header', 10 );
|
||||
|
||||
// Add transparent headers
|
||||
function flatsome_blog_header_classes( $classes ) {
|
||||
// Add transparent header to product page if set.
|
||||
if ( is_singular( 'post' ) && get_theme_mod( 'blog_single_transparent', 0 ) ) {
|
||||
$classes[] = 'transparent has-transparent nav-dark toggle-nav-dark';
|
||||
}
|
||||
if ( get_theme_mod( 'blog_archive_transparent', 0 ) && is_home() ) {
|
||||
$classes[] = 'transparent has-transparent nav-dark toggle-nav-dark';
|
||||
}
|
||||
return $classes;
|
||||
}
|
||||
|
||||
add_filter( 'flatsome_header_class', 'flatsome_blog_header_classes', 10 );
|
||||
|
||||
|
||||
// Add Big blog header
|
||||
function flatsome_single_page_header(){
|
||||
if(is_singular('post') && get_theme_mod('blog_post_style') == 'top'){
|
||||
get_template_part( 'template-parts/posts/partials/single-featured', get_theme_mod('blog_post_style'));
|
||||
}
|
||||
}
|
||||
add_action('flatsome_after_header','flatsome_single_page_header', 10);
|
||||
|
||||
|
||||
// Add Blog Archive title
|
||||
function flatsome_archive_title() {
|
||||
if ( get_theme_mod( 'blog_archive_title', 1 ) && ( is_archive() || is_search() ) ) {
|
||||
get_template_part( 'template-parts/posts/partials/archive-title' );
|
||||
}
|
||||
}
|
||||
add_action( 'flatsome_before_blog', 'flatsome_archive_title', 15 );
|
||||
|
||||
|
||||
// Remove the Auto scrolling if a Read more link is clicked
|
||||
function flatsome_remove_more_link_scroll( $link ) {
|
||||
$link = preg_replace( '|#more-[0-9]+|', '', $link );
|
||||
return $link;
|
||||
}
|
||||
add_filter( 'the_content_more_link', 'flatsome_remove_more_link_scroll' );
|
||||
|
||||
// Add HTML after blog posts
|
||||
function flatsome_before_blog_comments(){
|
||||
if(get_theme_mod('blog_after_post')){
|
||||
echo '<div class="html-before-comments mb">'.do_shortcode(get_theme_mod('blog_after_post')).'</div>';
|
||||
}
|
||||
}
|
||||
add_action('flatsome_before_comments','flatsome_before_blog_comments');
|
||||
|
||||
// Add button class to read more link
|
||||
if( ! function_exists('flatsome_add_morelink_class') ) {
|
||||
function flatsome_add_morelink_class( $link, $text ) {
|
||||
return str_replace(
|
||||
'more-link'
|
||||
,'more-link button primary smaller is-outline'
|
||||
,$link
|
||||
);
|
||||
}
|
||||
}
|
||||
add_action( 'the_content_more_link', 'flatsome_add_morelink_class', 10, 2 );
|
||||
|
||||
|
||||
/**
|
||||
* Display navigation to next/previous pages when applicable
|
||||
*/
|
||||
if ( ! function_exists( 'flatsome_content_nav' ) ) :
|
||||
|
||||
function flatsome_content_nav( $nav_id ) {
|
||||
global $wp_query, $post;
|
||||
|
||||
// Don't print empty markup on single pages if there's nowhere to navigate.
|
||||
if ( is_single() ) {
|
||||
$previous = ( is_attachment() ) ? get_post( $post->post_parent ) : get_adjacent_post( false, '', true );
|
||||
$next = get_adjacent_post( false, '', false );
|
||||
|
||||
if ( ! $next && ! $previous )
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't print empty markup in archives if there's only one page.
|
||||
if ( $wp_query->max_num_pages < 2 && ( is_home() || is_archive() || is_search() ) )
|
||||
return;
|
||||
|
||||
$nav_class = ( is_single() ) ? 'navigation-post' : 'navigation-paging';
|
||||
|
||||
?>
|
||||
<?php if ( is_single() ) : // navigation links for single posts ?>
|
||||
<nav role="navigation" id="<?php echo esc_attr( $nav_id ); ?>" class="<?php echo $nav_class; ?>">
|
||||
<div class="flex-row next-prev-nav bt bb">
|
||||
<div class="flex-col flex-grow nav-prev text-left">
|
||||
<?php previous_post_link( '<div class="nav-previous">%link</div>','<span class="hide-for-small">' .get_flatsome_icon('icon-angle-left') . _x( '', 'Previous post link', 'flatsome' ) . '</span> %title' ); ?>
|
||||
|
||||
</div>
|
||||
<div class="flex-col flex-grow nav-next text-right">
|
||||
<?php next_post_link( '<div class="nav-next">%link</div>', '%title <span class="hide-for-small">'. get_flatsome_icon('icon-angle-right') . _x( '', 'Next post link', 'flatsome' ) . '</span>' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php elseif ( $wp_query->max_num_pages > 1 && ( is_home() || is_archive() || is_search() ) ) : // navigation links for home, archive, and search pages ?>
|
||||
|
||||
<div class="flex-row">
|
||||
<div class="flex-col flex-grow">
|
||||
<?php if ( get_next_posts_link() ) : ?>
|
||||
<div class="nav-previous"><?php next_posts_link( __( '<span class="icon-angle-left"></span> Older posts', 'flatsome' ) ); ?></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="flex-col flex-grow">
|
||||
<?php if ( get_previous_posts_link() ) : ?>
|
||||
<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="icon-angle-right"></span>', 'flatsome' ) ); ?></div>
|
||||
<?php endif; ?> </div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</nav>
|
||||
|
||||
<?php
|
||||
}
|
||||
endif; // flatsome_content_nav
|
||||
|
||||
|
||||
if ( ! function_exists( 'flatsome_comment' ) ) :
|
||||
/**
|
||||
* Template for comments and pingbacks.
|
||||
*
|
||||
* Used as a callback by wp_list_comments() for displaying the comments.
|
||||
*/
|
||||
function flatsome_comment( $comment, $args, $depth ) {
|
||||
$GLOBALS['comment'] = $comment;
|
||||
switch ( $comment->comment_type ) :
|
||||
case 'pingback' :
|
||||
case 'trackback' :
|
||||
?>
|
||||
<li class="post pingback">
|
||||
<p><?php _e( 'Pingback:', 'flatsome' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( 'Edit', 'flatsome' ), '<span class="edit-link">', '<span>' ); ?></p>
|
||||
<?php
|
||||
break;
|
||||
default :
|
||||
?>
|
||||
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
|
||||
<article id="comment-<?php comment_ID(); ?>" class="comment-inner">
|
||||
|
||||
<div class="flex-row align-top">
|
||||
<div class="flex-col">
|
||||
<div class="comment-author mr-half">
|
||||
<?php echo get_avatar( $comment, 70 ); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex-col flex-grow">
|
||||
<?php printf( __( '%s <span class="says">says:</span>', 'flatsome' ), sprintf( '<cite class="strong fn">%s</cite>', get_comment_author_link() ) ); ?>
|
||||
<?php if ( $comment->comment_approved == '0' ) : ?>
|
||||
<em><?php _e( 'Your comment is awaiting moderation.', 'flatsome' ); ?></em>
|
||||
<br />
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="comment-content"><?php comment_text(); ?></div>
|
||||
|
||||
|
||||
<div class="comment-meta commentmetadata uppercase is-xsmall clear">
|
||||
<a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>"><time datetime="<?php comment_time( 'c' ); ?>" class="pull-left">
|
||||
<?php printf( _x( '%1$s at %2$s', '1: date, 2: time', 'flatsome' ), get_comment_date(), get_comment_time() ); ?>
|
||||
</time></a>
|
||||
<?php edit_comment_link( __( 'Edit', 'flatsome' ), '<span class="edit-link ml-half strong">', '<span>' ); ?>
|
||||
|
||||
<div class="reply pull-right">
|
||||
<?php
|
||||
comment_reply_link( array_merge( $args,array(
|
||||
'depth' => $depth,
|
||||
'max_depth' => $args['max_depth'],
|
||||
) ) );
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
<?php
|
||||
break;
|
||||
endswitch;
|
||||
}
|
||||
endif; // ends check for flatsome_comment()
|
||||
|
||||
if ( ! function_exists( 'flatsome_posted_on' ) ) :
|
||||
|
||||
// Prints HTML with meta information for the current post-date/time and author.
|
||||
function flatsome_posted_on() {
|
||||
$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
|
||||
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
|
||||
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
|
||||
}
|
||||
|
||||
$time_string = sprintf( $time_string,
|
||||
esc_attr( get_the_date( 'c' ) ),
|
||||
esc_html( get_the_date() ),
|
||||
esc_attr( get_the_modified_date( 'c' ) ),
|
||||
esc_html( get_the_modified_date() )
|
||||
);
|
||||
|
||||
$posted_on = sprintf(
|
||||
esc_html_x( 'Posted on %s', 'post date', 'flatsome' ),
|
||||
'<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
|
||||
);
|
||||
|
||||
$byline = sprintf(
|
||||
esc_html_x( 'by %s', 'post author', 'flatsome' ),
|
||||
'<span class="meta-author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span>'
|
||||
);
|
||||
|
||||
echo '<span class="posted-on">' . $posted_on . '</span><span class="byline"> ' . $byline . '</span>';
|
||||
|
||||
}
|
||||
endif;
|
||||
|
||||
function flatsome_featured_sticky_posts( $query ) {
|
||||
if ( get_theme_mod( 'blog_featured', '' ) && $query->is_home() && $query->is_main_query() ) {
|
||||
$query->set( 'ignore_sticky_posts', 1 );
|
||||
if ( get_theme_mod( 'blog_hide_sticky', 0 ) ) $query->set( 'post__not_in', get_option( 'sticky_posts' ) );
|
||||
}
|
||||
}
|
||||
add_action( 'pre_get_posts', 'flatsome_featured_sticky_posts' );
|
||||
|
||||
|
||||
// Filter in a link to a content ID attribute for the next/previous image links on image attachment pages
|
||||
function flatsome_enhanced_image_navigation( $url, $id ) {
|
||||
if ( ! is_attachment() && ! wp_attachment_is_image( $id ) )
|
||||
return $url;
|
||||
|
||||
$image = get_post( $id );
|
||||
if ( ! empty( $image->post_parent ) && $image->post_parent != $id )
|
||||
$url .= '#main';
|
||||
|
||||
return $url;
|
||||
}
|
||||
add_filter( 'attachment_link', 'flatsome_enhanced_image_navigation', 10, 2 );
|
||||
|
||||
|
||||
// Numbered Pagination
|
||||
if ( !function_exists( 'flatsome_posts_pagination' ) ) {
|
||||
|
||||
function flatsome_posts_pagination() {
|
||||
|
||||
$prev_arrow = is_rtl() ? get_flatsome_icon('icon-angle-right') : get_flatsome_icon('icon-angle-left');
|
||||
$next_arrow = is_rtl() ? get_flatsome_icon('icon-angle-left') : get_flatsome_icon('icon-angle-right');
|
||||
|
||||
global $wp_query;
|
||||
$total = $wp_query->max_num_pages;
|
||||
$big = 999999999; // need an unlikely integer
|
||||
if( $total > 1 ) {
|
||||
|
||||
if( !$current_page = get_query_var('paged') )
|
||||
$current_page = 1;
|
||||
if( get_option('permalink_structure') ) {
|
||||
$format = 'page/%#%/';
|
||||
} else {
|
||||
$format = '&paged=%#%';
|
||||
}
|
||||
$pages = paginate_links(array(
|
||||
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
|
||||
'format' => $format,
|
||||
'current' => max( 1, get_query_var('paged') ),
|
||||
'total' => $total,
|
||||
'mid_size' => 3,
|
||||
'type' => 'array',
|
||||
'prev_text' => $prev_arrow,
|
||||
'next_text' => $next_arrow,
|
||||
) );
|
||||
|
||||
if( is_array( $pages ) ) {
|
||||
$paged = ( get_query_var('paged') == 0 ) ? 1 : get_query_var('paged');
|
||||
echo '<ul class="page-numbers nav-pagination links text-center">';
|
||||
foreach ( $pages as $page ) {
|
||||
$page = str_replace("page-numbers","page-number",$page);
|
||||
echo "<li>$page</li>";
|
||||
}
|
||||
echo '</ul>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
function flatsome_sidebar_classes(){
|
||||
|
||||
echo implode(' ', apply_filters( 'flatsome_sidebar_class', array() ) );
|
||||
}
|
||||
|
||||
|
||||
function flatsome_add_sidebar_class($classes){
|
||||
//$classes[] = 'col-divided';
|
||||
//$classes[] = 'widgets-boxed';
|
||||
|
||||
return $classes;
|
||||
}
|
||||
|
||||
add_filter('flatsome_sidebar_class','flatsome_add_sidebar_class', 10);
|
||||
|
||||
/**
|
||||
* Renders the sidebar menu header content.
|
||||
*/
|
||||
function flatsome_mobile_sidebar_top_content() {
|
||||
if ( $top_content = get_theme_mod( 'mobile_sidebar_top_content' ) ) {
|
||||
echo '<div class="sidebar-menu-top-content">';
|
||||
echo do_shortcode( $top_content );
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'flatsome_before_sidebar_menu_elements', 'flatsome_mobile_sidebar_top_content' );
|
Reference in New Issue
Block a user