for posts and comments. add_theme_support( 'automatic-feed-links' ); // This theme uses wp_nav_menu() in one location. register_nav_menu( 'main', __( 'Main Menu', 'cafefaucher' ) ); // This theme uses wp_nav_menu() in one location. register_nav_menu( 'footer', __( 'Footer Menu', 'cafefaucher' ) ); // This theme uses wp_nav_menu() in one location. register_nav_menu( 'sitemap', __( 'Sitemap Menu', 'cafefaucher' ) ); /* * This theme supports custom background color and image, and here * we also set up the default background color. */ add_theme_support( 'custom-background', array( 'default-color' => 'e6e6e6', ) ); // This theme uses a custom image size for featured images, displayed on "standard" posts. add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 624, 9999 ); // Unlimited height, soft crop } add_action( 'after_setup_theme', 'cafefaucher_setup' ); /** * Enqueues scripts and styles for front-end. * * @since Cafe Faucher 1.0 */ function cafe_faucher_enqueue() { // Add Site Icons wp_enqueue_style( 'cafefaucher-icon-touch-png', get_template_directory_uri() . '/icons/touchicon.png' ); wp_enqueue_style( 'cafefaucher-icon-favicon-png', get_template_directory_uri() . '/icons/favicon.png' ); wp_enqueue_style( 'cafefaucher-icon-favicon-ico', get_template_directory_uri() . '/icons/favicon.ico' ); // Add Site CSS wp_enqueue_style( 'Boostrap-css-3.3.6', get_template_directory_uri() . '/css/bootstrap.min.css'); wp_enqueue_style( 'cafefaucher-style', get_stylesheet_uri() ); add_editor_style( 'editor-styling-css', get_template_directory_uri() . '/css/editor-style.css'); wp_enqueue_style( 'Boostrap-social-css', get_template_directory_uri() . '/css/bootstrap-social.css'); // Add Font Awesome icons (http://fontawesome.io) wp_enqueue_style( 'cafefaucher-fontawesome', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css' ); // Register the script like this for a theme: wp_enqueue_script( 'bootstrap-jquery', get_template_directory_uri() . '/js/jquery-1.12.3.min.js', array( 'jquery' ), '1.12.3', true ); wp_enqueue_script( 'bootsrap-js-3.3.6', get_template_directory_uri() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.6', true ); wp_enqueue_script( 'isInViewport-js', get_template_directory_uri() . '/js/isInViewport.min.js', array( 'jquery' ), '3.3.6', true ); wp_enqueue_script( 'cafefaucher-scripts', get_template_directory_uri() . '/js/cf-scripts.js', array('bootstrap-jquery'), '1.0.0', true ); wp_enqueue_script( 'toggle-scripts', get_template_directory_uri() . '/js/cf-toggle.js', array('jquery'), '1.0.0', true ); } if (!is_admin()) add_action( "wp_enqueue_scripts", "cafe_faucher_enqueue" ); /** * Enqueue Javascript postMessage handlers for the Customizer. * * Binds JS handlers to make the Customizer preview reload changes asynchronously. * * @since Cafe Faucher 1.0 */ function cafe_faucher_customize_preview_js() { wp_enqueue_script( 'cafe-faucher-customizer', get_template_directory_uri() . '/js/cf-customizer.js', array( 'customize-preview' ), '20141120', true ); } add_action( 'customize_preview_init', 'cafe_faucher_customize_preview_js' ); /** * Site tile tag setup * * @since Cafe Faucher 1.0 */ add_action( 'after_setup_theme', 'theme_functions' ); function theme_functions() { add_theme_support( 'title-tag' ); } add_filter( 'wp_title', 'custom_titles', 10, 2 ); function custom_titles( $title, $sep ) { //Check if custom titles are enabled from your option framework if ( ot_get_option( 'enable_custom_titles' ) === 'on' ) { //Some silly example $title = "Some other title" . $title;; } return $title; } if ( ! function_exists( 'cafefaucher_post_thumbnail' ) ) : /** * Displays post thumbnail. * * @since Cafe Faucher 1.0 */ function cafefaucher_post_thumbnail() { if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) { return; } if ( is_singular() ) : ?>
', ']]>', $text); $allowed_tags = '
,

,,,,'; /*** MODIFY THIS. Add the allowed HTML tags separated by a comma.***/ $text = strip_tags($text, $allowed_tags); $excerpt_word_count = 40; /*** MODIFY THIS. change the excerpt word count to any integer you like.***/ $excerpt_length = apply_filters('excerpt_length', $excerpt_word_count); $excerpt_end = '... ' . 'Read More ' . '';; /*** MODIFY THIS. change the excerpt endind to something else.***/ $excerpt_more = apply_filters('excerpt_more', ' ' . $excerpt_end); $words = preg_split("/[\n\r\t ]+/", $text, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY); if ( count($words) > $excerpt_length ) { array_pop($words); $text = implode(' ', $words); $text = $text . $excerpt_more; } else { $text = implode(' ', $words); } } return apply_filters('wp_trim_excerpt', $text, $raw_excerpt); } remove_filter('get_the_excerpt', 'wp_trim_excerpt'); add_filter('get_the_excerpt', 'custom_wp_trim_excerpt'); function excerpt($limit) { $excerpt = explode(' ', get_the_excerpt(), $limit); if (count($excerpt)>=$limit) { array_pop($excerpt); $excerpt = implode(" ",$excerpt).'...'; } else { $excerpt = implode(" ",$excerpt); } $excerpt = preg_replace('`\[[^\]]*\]`','',$excerpt); return $excerpt; } function content($limit) { $content = explode(' ', get_the_content(), $limit); if (count($content)>=$limit) { array_pop($content); $content = implode(" ",$content).'...'; } else { $content = implode(" ",$content); } $content = preg_replace('/\[.+\]/','', $content); $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); return $content; } if ( ! function_exists( 'cafefaucher_content_nav' ) ) : /** * Displays navigation to next/previous pages when applicable. * * @since Cafe Faucher 1.0 */ function cafefaucher_content_nav( $html_id ) { global $wp_query; $html_id = esc_attr( $html_id ); if ( $wp_query->max_num_pages > 1 ) : ?>

comment_type ) : case 'pingback' : case 'trackback' : // Display trackbacks differently than normal comments. ?>
  • id="comment-">

    ', '' ); ?>

  • id="li-comment-">
    user_id != '0' ) { echo '' . get_user_meta( $comment->user_id, 'nickname', true ) . ''; } else { echo '' . get_comment_author_link() . ''; } printf( '', esc_url( get_comment_link( $comment->comment_ID ) ), get_comment_time( 'c' ), /* translators: 1: date, 2: time */ sprintf( __( '%1$s at %2$s', 'cafefaucher' ), get_comment_date(), get_comment_time() ) ); ?>
    comment_approved ) : ?>

    ', '

    ' ); ?>
    __( 'Reply', 'cafefaucher' ), 'after' => ' ', 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
    ', esc_url( get_permalink() ), esc_attr( get_the_time() ), esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ) ); $author = sprintf( '', esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_attr( sprintf( __( 'View all posts by %s', 'cafefaucher' ), get_the_author() ) ), get_the_author() ); // Translators: 1 is category, 2 is tag, 3 is the date and 4 is the author's name. if ( $tag_list ) { $utility_text = __( 'This entry was posted in %1$s and tagged %2$s on %3$s by %4$s.', 'cafefaucher' ); } elseif ( $categories_list ) { $utility_text = __( 'This entry was posted in %1$s on %3$s by %4$s.', 'cafefaucher' ); } else { $utility_text = __( 'This entry was posted on %3$s by %4$s.', 'cafefaucher' ); } printf( $utility_text, $categories_list, $tag_list, $date, $author ); } endif; /** * Customizer additions. */ require get_template_directory() . '/include/customizer.php'; /** * Bootstraps nav walker, for main nav sub nav's * * @since Cafe Faucher 1.0 */ require_once('include/wp_bootstrap_navwalker.php'); /** * Display posts in carousel */ require get_template_directory() . '/include/cf-display-posts.php'; /** * Widgets additions */ require get_template_directory() . '/include/widgets.php'; /** * This file represents an example of the code that themes would use to register * the required plugins. * * It is expected that theme authors would copy and paste this code into their * functions.php file, and amend to suit. * * @see http://tgmpluginactivation.com/configuration/ for detailed documentation. * * @package TGM-Plugin-Activation * @subpackage Example * @version 2.5.2 for parent theme Cafefaucher for publication on WordPress.org * @author Thomas Griffin, Gary Jones, Juliette Reinders Folmer * @copyright Copyright (c) 2011, Thomas Griffin * @license http://opensource.org/licenses/gpl-2.0.php GPL v2 or later * @link https://github.com/TGMPA/TGM-Plugin-Activation */ /** * Include the TGM_Plugin_Activation class. */ require_once get_template_directory() . '/class-tgm-plugin-activation.php'; add_action( 'tgmpa_register', 'cafefaucher_register_required_plugins' ); /** * Register the required plugins for this theme. * * In this example, we register five plugins: * - one included with the TGMPA library * - two from an external source, one from an arbitrary source, one from a GitHub repository * - two from the .org repo, where one demonstrates the use of the `is_callable` argument * * The variable passed to tgmpa_register_plugins() should be an array of plugin * arrays. * * This function is hooked into tgmpa_init, which is fired within the * TGM_Plugin_Activation class constructor. */ function cafefaucher_register_required_plugins() { /* * Array of plugin arrays. Required keys are name and slug. * If the source is NOT from the .org repo, then source is also required. */ $plugins = array( // This is an example of how to include a plugin bundled with a theme. array( 'name' => 'Cafe Faucher Carousel Plugin', // The plugin name. 'slug' => 'cafe-faucher-carousel', // The plugin slug (typically the folder name). 'source' => get_template_directory() . '/plugins/cafe-faucher-carousel.zip', // The plugin source. 'required' => true, // If false, the plugin is only 'recommended' instead of required. 'version' => '', // E.g. 1.0.0. If set, the active plugin must be this version or higher. If the plugin version is higher than the plugin version installed, the user will be notified to update the plugin. '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. 'is_callable' => '', // If set, this callable will be be checked for availability to determine if a plugin is active. ), // This is an example of how to include a plugin from an arbitrary external source in your theme. array( 'name' => 'Display Posts Shortcode', // The plugin name. 'slug' => 'display-posts-shortcode', // The plugin slug (typically the folder name). 'source' => 'https://wordpress.org/plugins/display-posts-shortcode/', // The plugin source. 'required' => true, // If false, the plugin is only 'recommended' instead of required. 'external_url' => 'https://github.com/billerickson/display-posts-shortcode', // If set, overrides default API URL and points to an external URL. ), ); $config = array( 'id' => 'cafefaucher', // Unique ID for hashing notices for multiple instances of TGMPA. 'default_path' => '', // Default absolute path to bundled 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 ); }