tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support('title-tag');
add_theme_support( "custom-background" );
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
*/
add_theme_support('post-thumbnails');
/*
* Gutenberg support
*/
add_theme_support( 'wp-block-styles' );
add_theme_support( 'align-wide' );
add_theme_support( 'responsive-embeds' );
add_theme_support('editor-styles');
add_editor_style( 'dist/css/editor-style.min.css' );
/*
* 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',
)
);
// Set up the WordPress core custom background feature.
add_theme_support(
'custom-background',
apply_filters(
'affiliatebooster_custom_background_args',
array(
'default-color' => 'ffffff',
'default-image' => '',
)
)
);
// Add theme support for selective refresh for widgets.
add_theme_support('customize-selective-refresh-widgets');
}
endif;
add_action('after_setup_theme', 'affiliatebooster_setup');
add_action( 'after_setup_theme', 'font_add_all_variants', 100 );
function font_add_all_variants() {
if ( class_exists( 'Kirki_Fonts_Google' ) ) {
Kirki_Fonts_Google::$force_load_all_variants = true;
}
}
/**
* Set the content width in pixels, based on the theme's design and stylesheet.
*
* Priority 0 to make it available to lower priority callbacks.
*
* @global int $content_width
*/
function affiliatebooster_content_width()
{
$GLOBALS['content_width'] = apply_filters('affiliatebooster_content_width', 640);
}
add_action('after_setup_theme', 'affiliatebooster_content_width', 0);
/**
* Enqueue scripts and styles.
*/
function affiliatebooster_scripts()
{
//not minify version css
wp_enqueue_style('affiliatebooster-style', get_stylesheet_uri(), array(), 'affiliatebooster');
//wp_enqueue_style( 'affiliatebooster-style', get_template_directory_uri() . '/dist/css/style.min.css', array(), THEME_VERSION);
if (is_singular() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
}
add_action('wp_enqueue_scripts', 'affiliatebooster_scripts');
/**
* Implement HTML Compression.
*/
if ( !is_user_logged_in() ) {
add_action('get_header', 'pt_html_minify_start');
function pt_html_minify_start() {
ob_start( 'pt_html_minyfy_finish' );
}
function pt_html_minyfy_finish( $html ) {
$html = preg_replace('/).)*-->/s', '', $html);
$html = str_replace(array("\r\n", "\r", "\n", "\t"), '', $html);
while ( stristr($html, ' '))
$html = str_replace(' ', ' ', $html);
return $html;
}
}
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Functions which enhance the theme by hooking into WordPress.
*/
require get_template_directory() . '/inc/template-functions.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
/**
* Kirki TGM Plugin notice after theme activation.
*/
require get_template_directory() . '/inc/kirki_function.php';
/**
* Load Jetpack compatibility file.
*/
if (defined('JETPACK__VERSION')) {
require get_template_directory() . '/inc/jetpack.php';
}
//----------------------NEW-------------------------------//
function my_theme_enqueue_styles()
{
wp_enqueue_style('responsive', get_template_directory_uri() . '/dist/css/responsive.min.css');
wp_enqueue_style('bootstrap', get_template_directory_uri() . '/libs/bootstrap-4.5.2-dist/css/bootstrap.min.css');
wp_enqueue_style('fronted-style', get_template_directory_uri() . '/css/frontend-style.css');
wp_enqueue_style('fontello-affiliatebooster-icons-css', get_template_directory_uri() . '/libs/fontello-affiliatebooster-icons/css/affiliatebooster-icons.css');
wp_enqueue_script('aff-custom-script', get_template_directory_uri() . '/dist/js/main.min.js', array('jquery'));
}
add_action('wp_enqueue_scripts', 'my_theme_enqueue_styles');
add_action('admin_enqueue_scripts','admin_function');
function admin_function(){
wp_enqueue_script( 'admin_script', get_template_directory_uri() . '/js/admin_script.js' );
}
//Image Sizes
add_image_size( 'big-featured-image', 1200, 648 );
add_image_size( 'small-featured-image', 830, 448 );
add_image_size( 'related-featured-image', 300, 162 );
add_image_size( 'sidebar-featured-image', 120, 65 );
add_image_size( 'grid-featured-image', 500, 270, true );
add_image_size('aff-booster-recent-thumbnails', 55, 55, true);
// add_theme_support('post-thumbnails');
function wpdocs_custom_excerpt_length($length)
{
return 30;
}
add_filter('excerpt_length', 'wpdocs_custom_excerpt_length', 999);
function load_custom_wp_admin_style()
{
wp_register_style('custom_wp_admin_css', get_template_directory_uri() . '/dist/css/admin-style.min.css', false, '1.0.0');
wp_enqueue_style('custom_wp_admin_css');
}
add_action('admin_enqueue_scripts', 'load_custom_wp_admin_style');
/**
* Metabox in posts additions.
*/
include(get_template_directory() . '/elements/aff_booster_elements_metabox.php');
include(get_template_directory() . '/elements/aff_boostre_embed_metabox.php');
/**
* Author Extra.
*/
require get_template_directory() . '/inc/author-extra.php';
/**
* Widgets.
*/
require get_template_directory() . '/inc/widgets.php';
require get_template_directory() . '/inc/widgets-area.php';
/**
* Markups.
*/
require get_template_directory() . '/inc/markup.php';
/**
* Options.
*/
require get_template_directory() . '/inc/options.php';
/**
* Kirki Customizer.
*/
include_once get_theme_file_path('inc/class-kirki-installer-section.php');
require get_template_directory() . '/inc/customizer-kirki.php';
/**
* Custom get_the_excerpt.
*/
function the_excerpt_max_charlength( $charlength ){
$excerpt = get_the_excerpt();
//$charlength++;
if ($charlength == 0) {
echo '';
}
else if ( mb_strlen( $excerpt ) > $charlength ) {
$subex = mb_substr( $excerpt, 0, $charlength - 5 );
$exwords = explode( ' ', $subex );
$excut = - ( mb_strlen( $exwords[ count( $exwords ) - 1 ] ) );
if ( $excut < 0 ) {
echo mb_substr( $subex, 0, $excut );
} else {
echo $subex;
}
echo '[...]';
}
else {
echo $excerpt;
}
}
/* Theme methods */
function sitename_link_shortcode() {
$site_name = get_option('blogname');
$home_url = get_home_url();
return "".$site_name."";
}
function year_footer_shortcode() {
return date('Y');
}
function affiliatebooster_link_shortcode() {
$affiliatebooster_link = esc_html('https://www.affiliatebooster.com/');
return 'AffiliateBooster Theme';
}
function wpdocs_enqueue_custom_admin_style() {
wp_enqueue_style( 'admin-customizer', get_template_directory_uri() . '/css/admin-customizer-style.css' );
}
add_action( 'admin_enqueue_scripts', 'wpdocs_enqueue_custom_admin_style' );
add_action("wp_footer","add_class_some_function");
function add_class_some_function()
{
?>
'',
'default-text-color' => '000',
'width' => 1000,
'height' => 250,
'flex-width' => true,
'flex-height' => true,
);
add_theme_support( 'custom-header', $args );
}
add_action( 'after_setup_theme', 'themename_custom_header_setup' );