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' ); add_image_size( 'pager-medium-large', 360, 240, true ); // This theme uses wp_nav_menu() in one location. register_nav_menus( array( 'primary' => esc_html__( 'Header', 'pager' ), 'secondary' => esc_html__( 'Footer', 'pager' ), ) ); /* * 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', ) ); } endif; add_action( 'after_setup_theme', 'pager_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 */ function pager_content_width() { $GLOBALS['content_width'] = apply_filters( 'pager_content_width', 640 ); } add_action( 'after_setup_theme', 'pager_content_width', 0 ); /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ function pager_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Sidebar', 'pager' ), 'id' => 'sidebar-1', 'description' => esc_html__( 'Add widgets here.', 'pager' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Features', 'pager' ), 'id' => 'pager-features-section', 'description' => __( 'Click on Add a widget button below and add TEXT widget, which is highlighted by yellow color.', 'pager' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'pager_widgets_init' ); /** * Enqueue scripts and styles. */ function pager_scripts() { wp_enqueue_style( 'pager-style', get_stylesheet_uri() ); $pager_font_family = esc_html(get_theme_mod('pager_font_family', 'Hind')); wp_enqueue_style( 'pager-google-fonts', '//fonts.googleapis.com/css?family='. str_replace(" ", "+", $pager_font_family) .':300,400,700'); wp_enqueue_style( 'css-slicknav', get_template_directory_uri(). '/assets/css/slicknav.min.css'); wp_enqueue_style( 'font-awesome', get_template_directory_uri().'/assets/css/font-awesome.min.css'); wp_enqueue_script( 'pager-howljs', get_template_directory_uri() . '/assets/js/howljs.js', array(), '20151215', true ); wp_enqueue_script('jquery-slicknav', get_template_directory_uri() . '/assets/js/jquery.slicknav.min.js', array('jquery'),'1.1', true); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'wp_enqueue_scripts', 'pager_scripts' ); /** * Custom template tags for this theme. */ require get_template_directory() . '/inc/template-tags.php'; /*----------------------- * Custom Logo Support *----------------------*/ function pager_custom_logo() { add_theme_support('custom-logo'); } add_action('after_setup_theme', 'pager_custom_logo'); /** * Customizer additions. */ require get_template_directory() . '/inc/pager-heart/customizer.php'; /** * Pager Custom CSS for frontend */ require get_template_directory() . '/inc/pager-heart/pager-fronend-css.php'; /** * Social Icons Footer */ function pager_social_icon_footer(){ $themeModSocial = array( get_theme_mod("pager_social_facebook") , get_theme_mod("pager_social_twitter") , get_theme_mod("pager_social_google") , get_theme_mod("pager_social_pinterest") , get_theme_mod("pager_social_instagram") , get_theme_mod("pager_social_linkedin") , get_theme_mod("pager_social_youtube") , get_theme_mod("pager_social_rss") , get_theme_mod("pager_social_tumblr") , get_theme_mod("pager_social_soundcloud") ); $themeSocialSites = array("fa-facebook" => "facebook", "fa-twitter" => "twitter", "fa-google-plus" => "google", "fa-pinterest-p" => "pinterest", "fa-instagram" => "instagram", "fa-linkedin" => "linkedin", "fa-youtube" => "youtube", "fa-rss" => "rss", "fa-tumblr" => "tumblr", "fa-soundcloud" => "soundcloud"); if( in_array(true, $themeModSocial) ){ echo'

'. esc_html(get_theme_mod("pager_social_title")).'

'; } } /** * Footer Right */ function pager_footer_right(){ if(get_theme_mod("pager_footer_address") || get_theme_mod("pager_footer_email") || get_theme_mod("pager_footer_phone") || get_theme_mod("pager_footer_texthtml")){ echo'

'. esc_html(get_theme_mod("pager_footerr_title")).'

'; } } /** * Starter Content */ add_action('after_setup_theme', 'pager_starter_function'); function pager_starter_function() { add_theme_support( 'starter-content', array( 'posts' => array( 'home' => array( // Use a page template with the predefined about page 'template' => 'template-frontpage.php', ), ), 'options' => array( 'show_on_front' => 'page', 'page_on_front' => '{{home}}', ), 'widgets' => array( 'pager-features-section' => array( 'pager_iconbox1' => array( 'text', array( 'title' => 'Customize Using Customizer', // Blank title 'text' => '

To change title, text and icons of this box, go to frontpage -> features.

' ) ), 'pager_iconbox2' => array( 'text', array( 'title' => 'Customize Using Customizer', // Blank title 'text' => '

To change title, text and icons of this box, go to frontpage -> features.

' ) ) ) ), )); } add_filter( 'page_template', 'howlthemes_setpage_template' ); function howlthemes_setpage_template( $page_template ){ global $post; $post_slug = $post->post_name; $post_title = $post->post_title; if ( $post_slug == 'frontpage' || $post_title == 'frontpage') { $page_template = get_template_directory() . '/template-frontpage.php'; } return $page_template; } /** * Get an attachment ID given a URL. * * @param string $url * * @return int Attachment ID on success, 0 on failure */ function pager_get_attachment_id( $url ) { $attachment_id = 0; $dir = wp_upload_dir(); if ( false !== strpos( $url, $dir['baseurl'] . '/' ) ) { // Is URL in uploads directory? $file = basename( $url ); $query_args = array( 'post_type' => 'attachment', 'post_status' => 'inherit', 'fields' => 'ids', 'meta_query' => array( array( 'value' => $file, 'compare' => 'LIKE', 'key' => '_wp_attachment_metadata', ), ) ); $query = new WP_Query( $query_args ); if ( $query->have_posts() ) { foreach ( $query->posts as $post_id ) { $meta = wp_get_attachment_metadata( $post_id ); $original_file = basename( $meta['file'] ); $cropped_image_files = wp_list_pluck( $meta['sizes'], 'file' ); if ( $original_file === $file || in_array( $file, $cropped_image_files ) ) { $attachment_id = $post_id; break; } } } } return $attachment_id; }