tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
/*
* 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', array( 'post', 'page' ) );
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => esc_html__( 'Primary', 'fashionate' ),
) );
// Custom logo enable
add_theme_support( 'custom-logo', array(
'height' => 100,
'max-width' => 400,
'flex-height' => true,
'flex-width' => true,
'header-text' => array( 'site-title', 'site-description' ),
)
);
/*
* 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',
) );
// Set up the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'fashionate_custom_background_args', array(
'default-color' => '#f5f5f5',
'default-image' => '',
) ) );
}
endif;
add_action( 'after_setup_theme', 'fashionate_setup' );
/**
* 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
*/
/**
* Filter the except length to 20 words.
*
* @param int $length Excerpt length.
* @return int (Maybe) modified excerpt length.
*/
function fashionate_custom_excerpt_length( $length ) {
return 50;
}
add_filter( 'excerpt_length', 'fashionate_custom_excerpt_length', 999 );
function fashionate_excerpt_more( $more ) {
return '.';
}
add_filter( 'excerpt_more', 'fashionate_excerpt_more' );
function fashionate_content_width() {
$GLOBALS['content_width'] = apply_filters( 'fashionate_content_width', 640 );
}
add_action( 'after_setup_theme', 'fashionate_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function fashionate_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar', 'fashionate' ),
'id' => 'sidebar-1',
'description' => esc_html__( 'Add widgets here.', 'fashionate' ),
'before_widget' => '',
'before_title' => '
',
) );
}
add_action( 'widgets_init', 'fashionate_widgets_init' );
/**
* Enqueue scripts and styles.
*/
function fashionate_enqueue_scripts() {
// Fahionate Stylesheet
// Opensans fonts
wp_enqueue_style('fashinate-open-sans', 'https://fonts.googleapis.com/css?family=Open+Sans' );
// Vidolaka fonts
wp_enqueue_style('fashinate-Vidaloka', 'https://fonts.googleapis.com/css?family=Playfair+Display:400,700' );
// Bootstrap Stylesheet
wp_enqueue_style('bootstrap', get_template_directory_uri() . '/dist/css/bootstrap.css' );
// Fontawesome Stylesheet
wp_enqueue_style('font-awesome', get_template_directory_uri() . '/dist/css/font-awesome.css' );
// Owl carousel Stylesheet
wp_enqueue_style('owl-carousel', get_template_directory_uri() . '/dist/css/owl.carousel.css' );
// Theme main Stylesheet
wp_enqueue_style( 'fashinate-css', get_stylesheet_uri() );
// Fahionate Scripts
// Navigation scripts
wp_enqueue_script( 'fashionate-navigation', get_template_directory_uri() . '/dist/js/navigation.js', array('jquery'), '20151215', true );
// Skip Scripts
wp_enqueue_script( 'fashionate-skip-link-focus-fix', get_template_directory_uri() . '/dist/js/skip-link-focus-fix.js', array('jquery'), '20151215', true );
// Bootstrap Scripts
wp_enqueue_script( 'bootstrap-js', get_template_directory_uri() . '/dist/js/bootstrap.js', array('jquery'), '20120206', true );
// Owl carouesl Scripts
wp_enqueue_script( 'owl-carousel-js', get_template_directory_uri() . '/dist/js/owl.carousel.js', array('jquery'), '20120206', true );
// Fahionate Main Scripts
wp_enqueue_script( 'fashionate-js', get_template_directory_uri() . '/dist/js/fashionate.js', array('jquery'), '20120206', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'fashionate_enqueue_scripts' );
function fashionate_latest_sticky() {
/* Get all sticky posts */
$sticky = get_option( 'sticky_posts' );
if ($sticky):
/* Sort the stickies with the newest ones at the top */
rsort( $sticky );
/* Get the 5 newest stickies (change 5 for a different number) */
$sticky = array_slice( $sticky, 0, 5 );
/* Query sticky posts */
$the_query = new WP_Query( array( 'post__in' => $sticky, 'ignore_sticky_posts' => 1 ) );
// The Loop
if ( $the_query->have_posts() ) {
?>
have_posts() ) {
$the_query->the_post();
if ( has_post_thumbnail() ) :
?>