HEX
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/8.2.20
System: Linux 825a8fd6cf8c 3.10.0-1160.95.1.el7.x86_64 #1 SMP Mon Jul 24 13:59:37 UTC 2023 x86_64
User: apache (48)
PHP: 8.2.20
Disabled: NONE
Upload Files
File: /var/www/html/wp-content/themes/frameMyrskyNew/functions.php
<?php

//
//  Custom Child Theme Functions
//

// I've included a "commented out" sample function below that'll add a home link to your menu
// More ideas can be found on "A Guide To Customizing The Thematic Theme Framework" 
// http://themeshaper.com/thematic-for-wordpress/guide-customizing-thematic-theme-framework/

// Adds a home link to your menu
// http://codex.wordpress.org/Template_Tags/wp_page_menu
//function childtheme_menu_args($args) {
//    $args = array(
//        'show_home' => 'Home',
//        'sort_column' => 'menu_order',
//        'menu_class' => 'menu',
//        'echo' => true
//    );
//	return $args;
//}
//add_filter('wp_page_menu_args','childtheme_menu_args');

	// Widgets
  if(function_exists('register_sidebar')) {
	
		register_sidebar(array(
		'name' => __('Sidebar'),
		
		'before_widget' => '<li id="%1$s" class="widget %2$s">',
        'after_widget' => '</li>',
        'before_title' => '<h3>',
        'after_title' => '</h3>',

	));
	
}
	
  if(function_exists('register_sidebar')) {
	
		register_sidebar(array(
		'name' => __('Footer Menu'),
		
		'before_widget' => '',
        'after_widget' => '',
        'before_title' => '',
        'after_title' => '',

	));
			
}

  if(function_exists('register_sidebar')) {
	
		register_sidebar(array(
		'name' => __('Not in Head menu'),
		
		'before_widget' => '',
        'after_widget' => '',
        'before_title' => '',
        'after_title' => '',

	));
			
}


if (function_exists('register_sidebar')) {
register_sidebar(array(
'name' => 'index_order_search',
'id' => 'index_order_search',
'description' => 'index_order_search',
'before_widget' => '<div id="index_order_search">',
'after_widget' => '</div>',
'before_title' => '<h4>',
'after_title' => '</h4>'
));
} 


if (function_exists('register_sidebar')) {
register_sidebar(array(
'name' => 'index_news',
'id' => 'index_news',
'description' => 'index_news',
'before_widget' => '<div id="index_news">',
'after_widget' => '</div>',
'before_title' => '<h4>',
'after_title' => '</h4>'
));
} 


if (function_exists('register_sidebar')) {
register_sidebar(array(
'name' => 'index_pcb_seckill',
'id' => 'index_pcb_seckill',
'description' => 'index_pcb_seckill',
'before_widget' => '<div id="index_pcb_seckill">',
'after_widget' => '</div>',
'before_title' => '<h4>',
'after_title' => '</h4>'
));
}

if (function_exists('register_sidebar')) {
register_sidebar(array(
'name' => 'index_goods_list',
'id' => 'index_goods_list',
'description' => 'index_goods_list',
'before_widget' => '<div id="index_goods_list">',
'after_widget' => '</div>',
'before_title' => '<h4>',
'after_title' => '</h4>'
));
}  


if( function_exists( 'register_sidebar_widget' ) ) {     
    register_sidebar_widget('文章动态','widget_news'); 
	register_sidebar_widget('优惠供应','widget_featured');
	register_sidebar_widget('goods_list','widget_goods_list');
}  

function widget_news() { return ""; include( get_stylesheet_directory() . '/widget_news.php'); } 
function widget_featured() { return ""; include( get_stylesheet_directory()  . '/widget_featured.php'); } 
function widget_goods_list() { return ""; include( get_stylesheet_directory()  . '/widget_goods_list.php'); } 

function sp_breadcrumb($home, $sep, $prefix = '', $suffix = '', $display = true) {
	global $wp_query, $post;
	
	$opt['prefix']				= __("",'studiopress');
	$opt['archiveprefix'] 		= __("Archives for",'studiopress');
	$opt['searchprefix'] 		= __("Search for",'studiopress');
	
	function bold_or_not( $input ) {
		// return '<strong>'.$input.'</strong>';
		return $input;
	}

	// Copied and adapted from WP source
	function sp_get_category_parents($id, $link = FALSE, $separator = '/', $nicename = FALSE){
		$chain = '';
		$parent = &get_category($id);
		if ( is_wp_error( $parent ) )
		   return $parent;

		if ( $nicename )
		   $name = $parent->slug;
		else
		   $name = $parent->cat_name;

		if ( $parent->parent && ($parent->parent != $parent->term_id) )
		   $chain .= get_category_parents($parent->parent, true, $separator, $nicename);

		$chain .= bold_or_not($name);
		return $chain;
	}
	
	$on_front = get_option('show_on_front');
	
	if ($on_front == "page") {
		$homelink = '<a class="homelink" href="'.get_permalink(get_option('page_on_front')).'">Home</a>';
//@fengshuang 去除文章超链接 start
		//$bloglink = $homelink.' '.$sep.' <a href="'.get_permalink(get_option('page_for_posts')).'">'.get_the_title(get_option('page_for_posts')).'</a>';
		$bloglink = $homelink.' ';
//@fengshuang 去除文章超链接 end
	} else {
		$homelink = '<a class="homelink" href="'.get_bloginfo('url').'">'.$home.'</a>';
		$bloglink = $homelink;
	}
		
	if ( ($on_front == "page" && is_front_page()) || ($on_front == "posts" && is_home()) ) {
		$output = $home;
	} elseif ( $on_front == "page" && is_home() ) {
		$output = $homelink.' '.$sep.' <div class="homelinktitle">'.get_the_title(get_option('page_for_posts')).'</div>';
	} elseif ( !is_page() ) {
		$output = $bloglink.' '.$sep.' ';
		if (is_single()) {
			$cats = get_the_category();
			$cat = $cats[0];
//@fengshuang 现在分类目录无限级调用。
			if ($cat->parent != 0) {
				$output .= '<div class="homelinktitle">'.get_category_parents($cat->term_id, true, " ".$sep." ").'</div>';
			} else {
				$output .= '<a class="homelinktitle" href="'.get_category_link($cat->term_id).'">'.$cat->name.'</a> '.$sep.' '; 
			}
		}
		if ( is_category() ) {
			$cat = intval( get_query_var('cat') );
			$output .= '<div class="homelinktitle">'.sp_get_category_parents($cat, false, " ".$sep." ").'</div>';
		} elseif ( is_tag() ) {
			$output .= '<div class="homelinktitle">'.bold_or_not($opt['archiveprefix']." ".single_cat_title('',false)).'</div>';
		} elseif (is_date()) { 
			$output .= '<div class="homelinktitle">'.bold_or_not($opt['archiveprefix']." ".single_month_title(' ',false)).'</div>';
		} elseif (is_author()) { 
			$user = get_userdatabylogin($wp_query->query_vars['author_name']);
			$output .= '<div class="homelinktitle">'.bold_or_not($opt['archiveprefix']." ".$user->display_name).'</div>';
		} elseif (is_search()) {
			$output .= '<div class="homelinktitle">'.bold_or_not($opt['searchprefix'].' "'.get_search_query().'"').'</div>';
		} else {
			$output .= '<div class="homelinktitle">'.bold_or_not(get_the_title()).'</div>';
		}
	} else {
		$post = $wp_query->get_queried_object();

		// If this is a top level Page, it's simple to output the breadcrumb
		if ( 0 == $post->post_parent ) {
			$output = $homelink.' '.$sep.' <div class="homelinktitle">'.bold_or_not(get_the_title()).'</div>';
		} else {
			if (isset($post->ancestors)) {
				if (is_array($post->ancestors))
					$ancestors = array_values($post->ancestors);
				else 
					$ancestors = array($post->ancestors);				
			} else {
				$ancestors = array($post->post_parent);
			}

			// Reverse the order so it's oldest to newest
			$ancestors = array_reverse($ancestors);

			// Add the current Page to the ancestors list (as we need it's title too)
			$ancestors[] = $post->ID;

			$links = array();			
			foreach ( $ancestors as $ancestor ) {
				$tmp  = array();
				$tmp['title'] 	= strip_tags( get_the_title( $ancestor ) );
				$tmp['url'] 	= get_permalink($ancestor);
				$tmp['cur'] = false;
				if ($ancestor == $post->ID) {
					$tmp['cur'] = true;
				}
				$links[] = $tmp;
			}

			$output = $homelink;
			foreach ( $links as $link ) {
				$output .= ' '.$sep.' ';
				if (!$link['cur']) {
					$output .= '<a class="homelink" href="'.$link['url'].'">'.$link['title'].'</a>';
				} else {
					$output .= '<div class="homelinktitle">'.bold_or_not($link['title']).'</div>';
				}
			}
		}
	}
	if ($opt['prefix'] != "") {
		$output = $opt['prefix']." ".$output;
	}
	if ($display) {
		echo $prefix.$output.$suffix;
	} else {
		return $prefix.$output.$suffix;
	}
}


?>