Jquery 如何在站点添加Url链接
我正在创建与可湿性粉剂主题的网站,我创建使用同位素作为我的首选图像库。现在我想通过使用cat link ex#art概念,使用外部链接打开同位素过滤器。我尝试了每一个指南,但我的url链接仍然没有改变。有人能帮我吗?我还是个新手 顺便说一下我的代码:Jquery 如何在站点添加Url链接,jquery,wordpress,Jquery,Wordpress,我正在创建与可湿性粉剂主题的网站,我创建使用同位素作为我的首选图像库。现在我想通过使用cat link ex#art概念,使用外部链接打开同位素过滤器。我尝试了每一个指南,但我的url链接仍然没有改变。有人能帮我吗?我还是个新手 顺便说一下我的代码: //put jQuery in noConflict mode var $j = jQuery.noConflict(); $j(document).ready(function() { //-----------------------
//put jQuery in noConflict mode
var $j = jQuery.noConflict();
$j(document).ready(function() {
//----------------------------------------------
//--------------------------------------fancybox
//----------------------------------------------
//simple fancybox start
$j('.fancybox').fancybox({
//make sure fancybox knows we are loading images from wordpress
'type': 'image',
'autoSize' : true,
//lock the background when fancybox is active so weird padding doesn't show up
helpers : {
overlay : {
locked : false
}
}
});
//----------------------------------------------
//---------------------------------------isotope
//----------------------------------------------
//set container variable so we don't have to type alot
var $container = $j('.photogal');
//run function when all images touched by isotope are loaded
$container.imagesLoaded( function(){
//set parameters
$container.isotope({
//tell isotope what to target
itemSelector : '.element',
//set the layout mode
layoutMode: 'fitRows',
//tell isotope to use CSS3 if it can and fallback to jQuery
animationEngine : 'best-available',
//set masonry parameter
masonry: {
//we want 5 columns
columnWidth: $container.width() / 5
}
});
});
//tell isotope our filters are in the options id & links
var $optionSets = $j('#options'),
$optionLinks = $optionSets.find('a');
//click function to sort by data
$optionLinks.click(function(){
var $this = $j(this);
// don't proceed if already selected
if ( $this.hasClass('selected') ) {
return false;
}
var $optionSet = $this.parents('.option-set');
$optionSet.find('.selected').removeClass('selected');
$this.addClass('selected');
// make option object dynamically, i.e. { filter: '.my-filter-class' }
var options = {},
key = $optionSet.attr('data-option-key'),
value = $this.attr('data-option-value');
// parse 'false' as false boolean
value = value === 'false' ? false : value;
options[ key ] = value;
if ( key === 'layoutMode' && typeof changeLayoutMode === 'function' ) {
// changes in layout modes need extra logic
changeLayoutMode( $this, options );
} else {
// otherwise, apply new options
$container.isotope( options );
}
return false;
});
});
$(function(){
var $container = $('#filter'),
$body = $('body'),
colW = 60,
columns = null;
$container.isotope({
// disable window resizing
resizable: false,
masonry: {
columnWidth: colW
}
});
$(window).smartresize(function(){
// check if columns has changed
var currentColumns = Math.floor( ( $body.width() -10 ) / colW );
if ( currentColumns !== columns ) {
// set new column count
columns = currentColumns;
// apply width to container manually, then trigger relayout
$container.width( columns * colW )
.isotope('reLayout');
}
}).smartresize(); // trigger resize to set container width
});
我这里有自定义标签云,它会影响我的url链接吗
//----------------------------------------------
//-------------------custom tag cloud generation
//----------------------------------------------
function jss_generate_tag_cloud( $tags, $args = '' ) {
global $wp_rewrite;
//don't touch these defaults or the sky will fall
$defaults = array(
'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 0,
'format' => 'flat', 'separator' => "\n", 'orderby' => 'name', 'order' => 'ASC',
'topic_count_text_callback' => 'default_topic_count_text',
'topic_count_scale_callback' => 'default_topic_count_scale', 'filter' => 1
);
//determine if the variable is null
if ( !isset( $args['topic_count_text_callback'] ) && isset( $args['single_text'] ) && isset( $args['multiple_text'] ) ) {
//var_export
$body = 'return sprintf (
_n(' . var_export($args['single_text'], true) . ', ' . var_export($args['multiple_text'], true) . ', $count), number_format_i18n( $count ));';
//create_function
$args['topic_count_text_callback'] = create_function('$count', $body);
}
//parse arguments from above
$args = wp_parse_args( $args, $defaults );
//extract
extract( $args );
//check to see if they are empty and stop
if ( empty( $tags ) )
return;
//apply the sort filter
$tags_sorted = apply_filters( 'tag_cloud_sort', $tags, $args );
//check to see if the tags have been pre-sorted
if ( $tags_sorted != $tags ) { // the tags have been sorted by a plugin
$tags = $tags_sorted;
unset($tags_sorted);
} else {
if ( 'RAND' == $order ) {
shuffle($tags);
} else {
// SQL cannot save you
if ( 'name' == $orderby )
uasort( $tags, create_function('$a, $b', 'return strnatcasecmp($a->name, $b->name);') );
else
uasort( $tags, create_function('$a, $b', 'return ($a->count > $b->count);') );
if ( 'DESC' == $order )
$tags = array_reverse( $tags, true );
}
}
//check number and slice array
if ( $number > 0 )
$tags = array_slice($tags, 0, $number);
//set array
$counts = array();
//set array for alt tag
$real_counts = array();
foreach ( (array) $tags as $key => $tag ) {
$real_counts[ $key ] = $tag->count;
$counts[ $key ] = $topic_count_scale_callback($tag->count);
}
//determine min coutn
$min_count = min( $counts );
//default wordpress sizing
$spread = max( $counts ) - $min_count;
if ( $spread <= 0 )
$spread = 1;
$font_spread = $largest - $smallest;
if ( $font_spread < 0 )
$font_spread = 1;
$font_step = $font_spread / $spread;
$a = array();
//iterate thought the array
foreach ( $tags as $key => $tag ) {
$count = $counts[ $key ];
$real_count = $real_counts[ $key ];
$tag_link = '#' != $tag->link ? esc_url( $tag->link ) : '#';
$tag_id = isset($tags[ $key ]->id) ? $tags[ $key ]->id : $key;
$tag_name = $tags[ $key ]->name;
//If you want to do some custom stuff, do it here like we did
//call_user_func
$a[] = "<a href='#filter=$tag_name' class='tag-link-$tag_id'
data-option-value='.$tag_name'
title='" . esc_attr( call_user_func( $topic_count_text_callback, $real_count ) ) . "'>$tag_name</a>"; //background-color is added for validation purposes.
}
//set new format
switch ( $format ) :
case 'array' :
$return =& $a;
break;
case 'list' :
//create our own setup of how it will display and add all
$return = "<ul id='filters' class='option-set' data-option-key='filter'>\n\t
<li><a href='filter' data-option-value='*' class='selected'>All</a></li>
<li>";
//join
$return .= join( "</li>\n\t<li>", $a );
$return .= "</li>\n</ul>\n";
break;
default :
//return
$return = join( $separator, $a );
break;
endswitch;
//create new filter hook so we can do this
return apply_filters( 'jss_generate_tag_cloud', $return, $tags, $args );
}
//----------------------------------------------
//-------------------自定义标记云生成
//----------------------------------------------
函数jss_generate_tag_cloud($tags,$args=''){
全球$wp_重写;
//不要碰这些默认值,否则天会塌下来的
$defaults=数组(
'最小'=>8',最大'=>22',单位'=>pt',数字'=>0,
'格式'=>'平面','分隔符'=>“\n','排序依据'=>'名称','顺序'=>'ASC',
“topic\u count\u text\u callback”=>“default\u topic\u count\u text”,
'topic\u count\u scale\u callback'=>'default\u topic\u count\u scale','filter'=>1
);
//确定变量是否为空
if(!isset($args['topic\u count\u text\u callback'])和&isset($args['single\u text'])和&isset($args['multiple\u text'])){
//瓦鲁出口
$body='返回sprintf(
_n('.var_export($args['single_text'],true.),'.var_export($args['multiple_text'],true.),$count),数字_格式_i18n($count));
//创建函数
$args['topic\u count\u text\u callback']=create\u函数('$count',$body);
}
//解析上面的参数
$args=wp\u parse\u args($args,$defaults);
//提取
摘录($args);
//检查它们是否为空并停止
if(空($tags))
返回;
//应用排序过滤器
$tags\u sorted=apply\u过滤器('tag\u cloud\u sort',$tags,$args);
//检查标签是否已预先排序
如果($tags_sorted!=$tags){//标签已按插件排序
$tags=$tags\u排序;
未设置($tags\u sorted);
}否则{
如果('RAND'=$order){
洗牌($tags);
}否则{
//SQL无法拯救您
如果('name'=$orderby)
uasort($tags,create_函数('$a,$b','returnstrnatcasecamp($a->name,$b->name);');
其他的
uasort($tags,create_函数('$a,$b','return($a->count>$b->count););
如果('DESC'=$order)
$tags=array\u reverse($tags,true);
}
}
//检查数字和切片数组
如果($number>0)
$tags=array\u slice($tags,0,$number);
//集合数组
$counts=array();
//设置alt标记的数组
$real_counts=array();
foreach((数组)$标记为$key=>$tag){
$real_counts[$key]=$tag->count;
$counts[$key]=$topic\u count\u scale\u回调($tag->count);
}
//测定最小电流
$min_count=min($counts);
//默认wordpress大小
$spread=最大($counts)-$minu count;
如果($spread$tag){
$count=$counts[$key];
$real_count=$real_counts[$key];
$tag_link='#'!=$tag->link?esc_url($tag->link):'#';
$tag_id=isset($tags[$key]->id)$tags[$key]->id:$key;
$tag_name=$tags[$key]->name;
//如果你想做一些定制的东西,像我们一样在这里做
//调用用户函数
$a[]=“”;//添加背景色是为了验证。
}
//设置新格式
交换机($格式):
案例“数组”:
$return=&$a;
打破
个案"名单":
//创建我们自己的设置,它将如何显示和添加所有
$return=“\n\t
- “;
//加入
$return.=join(“
\n\t- ”,$a);
$return.=“
\n
\n”;
打破
违约:
//返回
$return=join($separator,$a);
打破
终端开关;
//创建新的过滤器挂钩,这样我们就可以做到这一点
return apply_filters('jss_generate_tag_cloud',$return,$tags,$args);
}
我的网站是www.uniqueconceptz.com。
之前谢谢。有人吗?我真的搞不懂谁?我真的很困惑