1. use jQuery
Paste the following code in a javascript file,such as:cwp-flat-ui-seo.js
jQuery(function(){
jQuery('.breadcrumb').attr({'itemscope':'itemscope','itemtype':'http://data-vocabulary.org/Breadcrumb'}).find('a').attr({'itemprop':'url'});
jQuery('.breadcrumb a').each(function(){
var content_in_tag_a=jQuery(this).html();
jQuery(this).html('').append('<span itemprop="title">'+content_in_tag_a).prepend('</span>');
});
/*下面的仅仅是测试 气动隔膜泵用的!*/
/*alert('aaa');*/
/*END*/
});
2.PHP code for the plugin
<?php
/*
**************************************************************************
Plugin Name: Coolwp XXX add-on
Plugin URI: http://www.cdut.edu.cn/
Description: 这是一个气动隔膜泵品牌.....
Version: 1.0
Author: Suifengtec
Author URI: http://suoling.net/
Domain Path: /lang/
**************************************************************************
*/
define('CWP_PLUGIN_XXX_ADD_ON_VER','1.0');
add_action('wp_enqueue_scripts','cwp_flat_ui',999);
function cwp_flat_ui(){
wp_register_style('cwp-flat-ui', plugins_url('css/css.css', __FILE__) ,false, CWP_PLUGIN_XXX_ADD_ON_VER, 'all' ); //you may ignore this css file
wp_register_script('cwp-flat-ui-seo', plugins_url('js/cwp-flat-ui-seo.js', __FILE__), array('jquery'),CWP_PLUGIN_XXX_ADD_ON_VER,true); //it is!
wp_enqueue_style( 'cwp-flat-ui'); //you may ignore this css file
wp_enqueue_script('cwp-flat-ui-seo'); //it is!
}
3. Add Breadcrumbs to your theme
/*-----------------------------------------------------------------------------------*/
/* Breadcrumb
Usage:
<div class="breadcrumb" itemprop="breadcrumb"><?php cwp_the_breadcrumb(); ?></div>
/*-----------------------------------------------------------------------------------*/
function cwp_the_breadcrumb() {
echo '<a href="';
echo home_url();
echo '" rel="nofollow"><i class="icon-home"></i> '.__('Home','cwpsl');
echo "</a>";
if (is_category() || is_single()) {
echo " » ";
the_category(' & ');
if (is_single()) {
echo " » ";
the_title();
}
} elseif (is_page()) {
echo " » ";
echo the_title();
} elseif (is_search()) {
echo " » ".__('Search Results for','cwpsl')."... ";
echo '"<em>';
echo the_search_query();
echo '</em>"';
}
}
Notice: Your breadcrumbs navigation should be wrapped in a div which has a class "breadcrumbs", under normal circumstances is that, if your theme is not in case , you need to modify the selector in the above js code.
Thanks! bear with my poor english.
Paste the following code in a javascript file,such as:cwp-flat-ui-seo.js
jQuery(function(){
jQuery('.breadcrumb').attr({'itemscope':'itemscope','itemtype':'http://data-vocabulary.org/Breadcrumb'}).find('a').attr({'itemprop':'url'});
jQuery('.breadcrumb a').each(function(){
var content_in_tag_a=jQuery(this).html();
jQuery(this).html('').append('<span itemprop="title">'+content_in_tag_a).prepend('</span>');
});
/*下面的仅仅是测试 气动隔膜泵用的!*/
/*alert('aaa');*/
/*END*/
});
2.PHP code for the plugin
<?php
/*
**************************************************************************
Plugin Name: Coolwp XXX add-on
Plugin URI: http://www.cdut.edu.cn/
Description: 这是一个气动隔膜泵品牌.....
Version: 1.0
Author: Suifengtec
Author URI: http://suoling.net/
Domain Path: /lang/
**************************************************************************
*/
define('CWP_PLUGIN_XXX_ADD_ON_VER','1.0');
add_action('wp_enqueue_scripts','cwp_flat_ui',999);
function cwp_flat_ui(){
wp_register_style('cwp-flat-ui', plugins_url('css/css.css', __FILE__) ,false, CWP_PLUGIN_XXX_ADD_ON_VER, 'all' ); //you may ignore this css file
wp_register_script('cwp-flat-ui-seo', plugins_url('js/cwp-flat-ui-seo.js', __FILE__), array('jquery'),CWP_PLUGIN_XXX_ADD_ON_VER,true); //it is!
wp_enqueue_style( 'cwp-flat-ui'); //you may ignore this css file
wp_enqueue_script('cwp-flat-ui-seo'); //it is!
}
3. Add Breadcrumbs to your theme
/*-----------------------------------------------------------------------------------*/
/* Breadcrumb
Usage:
<div class="breadcrumb" itemprop="breadcrumb"><?php cwp_the_breadcrumb(); ?></div>
/*-----------------------------------------------------------------------------------*/
function cwp_the_breadcrumb() {
echo '<a href="';
echo home_url();
echo '" rel="nofollow"><i class="icon-home"></i> '.__('Home','cwpsl');
echo "</a>";
if (is_category() || is_single()) {
echo " » ";
the_category(' & ');
if (is_single()) {
echo " » ";
the_title();
}
} elseif (is_page()) {
echo " » ";
echo the_title();
} elseif (is_search()) {
echo " » ".__('Search Results for','cwpsl')."... ";
echo '"<em>';
echo the_search_query();
echo '</em>"';
}
}
Notice: Your breadcrumbs navigation should be wrapped in a div which has a class "breadcrumbs", under normal circumstances is that, if your theme is not in case , you need to modify the selector in the above js code.
Thanks! bear with my poor english.