__( 'Header Menu', 'yydevelopment-basic' ),
) );
// ----------------------------------------------------------------------------
// This feature adds RSS feed links to HTML
// ----------------------------------------------------------------------------
add_theme_support( 'automatic-feed-links' );
// ----------------------------------------------------------------------------
// This function addes to the site header
// ----------------------------------------------------------------------------
add_theme_support( "title-tag" );
// ----------------------------------------------------------------------------
// Adding the option to head custom background and css to the theme editor
// ----------------------------------------------------------------------------
$args = array(
'default-color' => '',
'default-image' => '',
);
add_theme_support( 'custom-background', $args );
// ----------------------------------------------------------------------------
// This feature adds the option to set excerpt in pages and blog posts
// ----------------------------------------------------------------------------
add_post_type_support( 'page', 'excerpt' );
// ----------------------------------------------------------------------------
// Adding the option to add featured images on posts and pages
// ----------------------------------------------------------------------------
add_theme_support( 'post-thumbnails' );
// ----------------------------------------------------------------------------
// enabling shortcode in widgets
// ----------------------------------------------------------------------------
add_filter( 'widget_text', 'do_shortcode' );
// ----------------------------------------------------------------------------
// This function allow us to control the resize of images on the theme
// should be set as the max width of the images on page
// ----------------------------------------------------------------------------
if ( ! isset( $content_width ) ) {
$content_width = 1200;
} // if ( ! isset( $content_width ) ) {
// ----------------------------------------------------------------------------
// Allow to add formats to the pages
// ----------------------------------------------------------------------------
add_theme_support( 'post-formats', array('video') );
// add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link', 'gallery', 'status', 'audio', 'chat' ) );
// ----------------------------------------------------------------------------
// Checking if sidebar registered and set class
// $sidebar = the sidebar we want to load 'sidebar' is the default value
// ----------------------------------------------------------------------------
function yydev_theme_check_active_sidebar($sidebar = 'sidebar') {
$right_side_class = '';
if( is_active_sidebar( $sidebar ) ) {
$right_side_class = "main-content-warp";
} // if( is_active_sidebar( $sidebar ) ) {
return $right_side_class;
} // function yydev_theme_check_active_sidebar($yydev_theme_data['yy_pages_sidebar']) {
// ----------------------------------------------------------------------------
// This code will allow us to make changes to the blog excerpt
// ----------------------------------------------------------------------------
// -----------------------------------------
// Changing the text for the read more button
// -----------------------------------------
function yydev_theme_new_excerpt_more($more) {
global $post;
global $excerpt_read_text;
return ' ' . __('Read More...', 'yydevelopment-basic') . '';
} // function yydev_theme_new_excerpt_more($more) {
add_filter('excerpt_more', 'yydev_theme_new_excerpt_more');
// -----------------------------------------
// Changing the amount of word that will display in the excerpt
// -----------------------------------------
$yy_excerpt_words_count = $yydev_theme_data['yy_excerpt_words_count']; // set the amount of words to display
function yydev_theme_custom_excerpt_length( $length ) {
global $yy_excerpt_words_count;
return $yy_excerpt_words_count;
} // function yydev_theme_custom_excerpt_length( $length ) {
add_filter( 'excerpt_length', 'yydev_theme_custom_excerpt_length', 999 );
// ----------------------------------------------------------------------------
// Remove unnecessary code from the in the pages
// ----------------------------------------------------------------------------
remove_action('wp_head', 'rsd_link');
// ----------------------------------------------------------------------------
// Remove wordpress version from the page
// ----------------------------------------------------------------------------
function yydev_theme_remove_wordpress_version() {
return '';
}
add_filter('the_generator', 'yydev_theme_remove_wordpress_version');
// ----------------------------------------------------------------------------
// Remove Wordpress emoji code
// ----------------------------------------------------------------------------
remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('wp_print_styles', 'print_emoji_styles');
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
// ----------------------------------------------------------------------------
// Adding the page number in header to categories and tags
// ----------------------------------------------------------------------------
function yydev_theme_name_wp_title( $title, $sep ) {
if ( is_feed() ) { return $title; }
global $page, $paged;
// Add the blog name
$title .= get_bloginfo( 'name', 'display' );
// Add a page number if necessary:
if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) {
$title .= " $sep " . sprintf( __( 'Page %s', 'yydevelopment-basic' ), max( $paged, $page ) );
} // if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) {
return $title;
} // function yydev_theme_name_wp_title( $title, $sep ) {
add_filter( 'wp_title', 'yydev_theme_name_wp_title', 10, 2 );
// ----------------------------------------------------------------------------
// This function allow us to have pages navigation on the blog page.
// The amount of post on each page is set from the admin panel
// ----------------------------------------------------------------------------
function yydev_theme_show_pages($output = true) {
global $wp_query;
$big = 999999999; // need an unlikely integer
$pages_output = "";
$pages_output .= "";
if( $output ) {
echo $pages_output;
} else { // if( $output ) {
return $pages_output;
} // } else { // if( $output ) {
} // function yydev_theme_show_pages($output = true) {
// ----------------------------------------------------------------------------
// This function will alow to create pages within pages and posts
// ----------------------------------------------------------------------------
function yydev_theme_link_pages($output = true) {
$pages_output = wp_link_pages(
array(
'before' => '',
'echo' => false,
'previouspagelink' => "«",
'nextpagelink' => "»",
)
);
if( $output ) {
echo $pages_output;
} else { // if( $output ) {
return $pages_output;
} // } else { // if( $output ) {
} // function yydev_theme_link_pages($output = true) {
// ----------------------------------------------------------------------------
// prevet wordpress from creating images in diffferent sizes when uploading images into the media library
// ----------------------------------------------------------------------------
if( $yydev_theme_data['yy_stop_wp_images_resize'] == 1 ) {
add_filter( 'intermediate_image_sizes', '__return_empty_array', 999 );
} // if( $yydev_theme_data['yy_stop_wp_images_resize'] == 1 ) {
?>