";
}
}
/* Max Title Length Widget
========================================================================== */
function pepe_lite_max_title_length( $title ) {
$max = 10;
if( strlen( $title ) > $max ) {
return substr( $title, 0, $max );
} else {
return $title;
}
}
/* Add Span in Widget Title */
function pepe_lite_span_widget_title( $title ) {
$output = '';
$output .= $title;
$output .= '';
return $output;
}
add_filter( 'widget_title', 'pepe_lite_span_widget_title' );
/* Breadcrumbs
========================================================================== */
function pepe_lite_custom_breadcrumbs() {
$sep = ' > ';
if (!is_front_page()) {
// Start the breadcrumb with a link to your homepage
echo '
';
echo '';
bloginfo('name');
echo '' . $sep;
// Check if the current page is a category, an archive or a single page. If so show the category or archive name.
if (is_category() || is_single() ){
the_category($sep);
} elseif (is_archive() || is_single()){
if ( is_day() ) {
printf( __( '%s', 'pepe-lite' ), esc_html(get_the_date()) );
} elseif ( is_month() ) {
printf( __( '%s', 'pepe-lite' ), esc_html(get_the_date( _x( 'F Y', 'monthly archives date format', 'pepe-lite' ) )) );
} elseif ( is_year() ) {
printf( __( '%s', 'pepe-lite' ), esc_html(get_the_date( _x( 'Y', 'yearly archives date format', 'pepe-lite' )) ) );
} else {
esc_html_e( 'Blog Archives', 'pepe-lite' );
}
}
// If the current page is a single post, show its title with the separator
if (is_single()) {
echo esc_attr($sep);
the_title();
}
// If the current page is a static page, show its title.
if (is_page()) {
echo the_title();
}
// if you have a static page assigned to be you posts list page. It will find the title of the static page and display it. i.e Home >> Blog
if (is_home()){
global $post;
$page_for_posts_id = get_option('page_for_posts');
if ( $page_for_posts_id ) {
$post = get_page($page_for_posts_id);
setup_postdata($post);
the_title();
rewind_posts();
}
}
echo '
__('MC4WP: Mailchimp for WordPress','pepe-lite'),
'slug' => 'mailchimp-for-wp',
'required' => false,
),
// On Click Demo Import
array(
'name' => __('One Click Demo Import','pepe-lite'),
'slug' => 'one-click-demo-import',
'required' => false,
),
);
$config = array(
'id' => 'pepe-pepe', // 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.
'strings' => array(
'page_title' => __( 'Install Required Plugins', 'pepe-lite' ),
'menu_title' => __( 'Install Plugins', 'pepe-lite' ),
/* translators: %s: search term */
'installing' => __( 'Installing Plugin: %s', 'pepe-lite' ),
/* translators: %s: search term */
'updating' => __( 'Updating Plugin: %s', 'pepe-lite' ),
'oops' => __( 'Something went wrong with the plugin API.', 'pepe-lite' ),
/* translators: %1: search term */
'notice_can_install_required' => _n_noop(
'This theme requires the following plugin: %1$s.',
'This theme requires the following plugins: %1$s.',
'pepe-lite'
),
/* translators: %1: search term */
'notice_can_install_recommended' => _n_noop(
'This theme recommends the following plugin: %1$s.',
'This theme recommends the following plugins: %1$s.',
'pepe-lite'
),
/* translators: %1: search term */
'notice_ask_to_update' => _n_noop(
'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.',
'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.',
'pepe-lite'
),
/* translators: %1: search term */
'notice_ask_to_update_maybe' => _n_noop(
'There is an update available for: %1$s.',
'There are updates available for the following plugins: %1$s.',
'pepe-lite'
),
/* translators: %1: search term */
'notice_can_activate_required' => _n_noop(
'The following required plugin is currently inactive: %1$s.',
'The following required plugins are currently inactive: %1$s.',
'pepe-lite'
),
/* translators: %1: search term */
'notice_can_activate_recommended' => _n_noop(
'The following recommended plugin is currently inactive: %1$s.',
'The following recommended plugins are currently inactive: %1$s.',
'pepe-lite'
),
'install_link' => _n_noop(
'Begin installing plugin',
'Begin installing plugins',
'pepe-lite'
),
'update_link' => _n_noop(
'Begin updating plugin',
'Begin updating plugins',
'pepe-lite'
),
'activate_link' => _n_noop(
'Begin activating plugin',
'Begin activating plugins',
'pepe-lite'
),
'return' => __( 'Return to Required Plugins Installer', 'pepe-lite' ),
'plugin_activated' => __( 'Plugin activated successfully.', 'pepe-lite' ),
'activated_successfully' => __( 'The following plugin was activated successfully:', 'pepe-lite' ),
/* translators: %1: search term */
'plugin_already_active' => __( 'No action taken. Plugin %1$s was already active.', 'pepe-lite' ),
/* translators: %s: search term */
'plugin_needs_higher_version' => __( 'Plugin not activated. A higher version of %s is needed for this theme. Please update the plugin.', 'pepe-lite' ),
/* translators: %1: search term */
'complete' => __( 'All plugins installed and activated successfully. %1$s', 'pepe-lite' ),
'dismiss' => __( 'Dismiss this notice', 'pepe-lite' ),
'notice_cannot_install_activate' => __( 'There are one or more required or recommended plugins to install, update or activate.', 'pepe-lite' ),
'contact_admin' => __( 'Please contact the administrator of this site for help.', 'pepe-lite' ),
'nag_type' => '', // Determines admin notice type - can only be one of the typical WP notice classes, such as 'updated', 'update-nag', 'notice-warning', 'notice-info' or 'error'. Some of which may not work as expected in older WP versions.
),
);
tgmpa( $plugins, $config );
}
/* Custom Excerpt
========================================================================== */
function pepe_lite_custom_excerpt_length( $length ) {
$pepe_excpert= 15;
return $pepe_excpert;
}
add_filter( 'excerpt_length', 'pepe_lite_custom_excerpt_length', 999 );
function pepe_lite_excerpt_more( $more ) {
$pepe_more= ( __('...','pepe-lite'));
return $pepe_more;
}
add_filter( 'excerpt_more', 'pepe_lite_excerpt_more' );
/* Demo Importer
========================================================================== */
// Menu and Page
function pepe_lite_after_import_setup() {
// Assign menus to their locations.
$primary = get_term_by( 'name', 'Primary', 'nav_menu' );
$top = get_term_by( 'name', 'Top', 'nav_menu' );
set_theme_mod( 'nav_menu_locations', array(
'menu-1' => $primary->term_id,
'menu-2' => $top->term_id,
)
);
}
add_action( 'pt-ocdi/after_import', 'pepe_lite_after_import_setup' );
// Custum Text Plugin
function pepe_lite_plugin_intro_text( $default_text ) {
$default_text .= '