我正在为朋友业务做一些编辑工作,而wordpress模板是以非常古老的方式编写的。我已经弄清楚大多数代码是如何工作的,但是有一点让我不知道的是文件引用css信息的地方,它不是以任何常用的方式导入它而且它没有使用主要的wordpress主题css文件。我无法在firebug中找到资源。任何人都可以帮助我理解这段代码的工作原理我特意试图访问singleStyle div的css信息
URL: http://wp.rafelshearling.com/?page_id=319
代码:
<?php
/**
* The template used for displaying page content in page.php
*
* @package WordPress
* @subpackage Twenty_Eleven
* @since Twenty Eleven 1.0
<?php the_ID(); ?>
post_class();
*/
?>
<h1 class="entry-title"><?php the_title(); ?></h1>
<div class="entry-content">
<?php if(is_page( array( 319, 321 ) ) ) { ?>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<?php if(is_page( 319 ) ) { // Mens ?>
<script>
var pageNum = 1;
var catIndex = 0;
var pageMax, catSlugList = ["jackets"];
var originalCat = catSlugList[catIndex];
var originalCatID = 9;
$(function() {
$.ajax({
url: '/?json=get_category_posts&slug='+originalCat+'&count=12&page='+pageNum+'&exclude=categories,type,url,title_plain,status,excerpt,comments,comment_count,comment_status,tags,attachments,modified,date,author',
success: function(data) {
pageMax = data.pages;
var $collectionDiv = $("#styleCollectionDiv").children("div:eq(1)");
var $showLargerDiv = $("#viewLargerDiv");
for(var i in data.posts){
$collectionDiv.append("<div class='singleStyle'>"+data.posts[i].content+"<p>"+data.posts[i].title+"</p></div>");
}
$showLargerDiv.append($collectionDiv.children("div:eq(0)").clone());
$("#stylesDiv .singleStyle").mouseenter( function(e){
$("#viewLargerDiv").empty().append($(this).clone());
});
$(".childrenUls a").removeClass("active");
$(".childrenUls a:eq("+catIndex+")").addClass("active");
}
});
$(".childrenUls a").click( function(e){
return false;
});
$("#collectionNav p a").click( function(e){
if(this.getAttribute("href") === "#Back"){
if(pageNum === 1){
return false;
} else {
pageNum--;
$.ajax({
url: '/?json=get_category_posts&slug='+originalCat+'&count=12&page='+pageNum+'&exclude=categories,type,url,title_plain,status,excerpt,comments,comment_count,comment_status,tags,attachments,modified,date,author',
success: function(data) {
$("#stylesDiv, #viewLargerDiv").empty();
pageMax = data.pages;
var $collectionDiv = $("#styleCollectionDiv").children("div:eq(1)");
var $showLargerDiv = $("#viewLargerDiv");
for(var i in data.posts){
$collectionDiv.append("<div class='singleStyle'>"+data.posts[i].content+"<p>"+data.posts[i].title+"</p></div>");
}
$showLargerDiv.append($collectionDiv.children("div:eq(0)").clone());
$("#stylesDiv .singleStyle").mouseenter( function(e){
$("#viewLargerDiv").empty().append($(this).clone());
});
$(".childrenUls a").removeClass("active");
$(".childrenUls a:eq("+catIndex+")").addClass("active");
}
});
}
} else if(this.getAttribute("href") === "#More"){
if(pageNum < pageMax){
pageNum++;
$.ajax({
url: '/?json=get_category_posts&slug='+originalCat+'&count=12&page='+pageNum+'&exclude=categories,type,url,title_plain,status,excerpt,comments,comment_count,comment_status,tags,attachments,modified,date,author',
success: function(data) {
$("#stylesDiv, #viewLargerDiv").empty();
pageMax = data.pages;
var $collectionDiv = $("#styleCollectionDiv").children("div:eq(1)");
var $showLargerDiv = $("#viewLargerDiv");
for(var i in data.posts){
$collectionDiv.append("<div class='singleStyle'>"+data.posts[i].content+"<p>"+data.posts[i].title+"</p></div>");
}
$showLargerDiv.append($collectionDiv.children("div:eq(0)").clone());
$("#stylesDiv .singleStyle").mouseenter( function(e){
$("#viewLargerDiv").empty().append($(this).clone());
});
$(".childrenUls a").removeClass("active");
$(".childrenUls a:eq("+catIndex+")").addClass("active");
}
});
} else {
return false
}
}
return false;
});
});
</script>
<ul class="childrenUls cMe">
<?php wp_list_categories('child_of=5&orderby=id&order=DESC&title_li='); ?>
</ul>
<?php } else if(is_page( 321 ) ) { // Womens ?>
<script>
var pageNum = 1;
var catIndex = 0;
var pageMax, catSlugList = ["jackets-vests-assessories","hip-34-length","full-length"];
var originalCat = catSlugList[catIndex];
var originalCatID = 8;
$(function() {
$.ajax({
url: '/?json=get_category_posts&slug='+originalCat+'&count=12&page='+pageNum+'&exclude=categories,type,url,title_plain,status,excerpt,comments,comment_count,comment_status,tags,attachments,modified,date,author',
success: function(data) {
pageMax = data.pages;
var $collectionDiv = $("#styleCollectionDiv").children("div:eq(1)");
var $showLargerDiv = $("#viewLargerDiv");
for(var i in data.posts){
$collectionDiv.append("<div class='singleStyle'>"+data.posts[i].content+"<p>"+data.posts[i].title+"</p></div>");
}
$showLargerDiv.append($collectionDiv.children("div:eq(0)").clone());
$("#stylesDiv .singleStyle").mouseenter( function(e){
$("#viewLargerDiv").empty().append($(this).clone());
});
$(".childrenUls a").removeClass("active");
$(".childrenUls a:eq("+catIndex+")").addClass("active");
}
});
$(".childrenUls a").click( function(e){
catIndex = $(".childrenUls a").index(this);
pageNum = 1;
$.ajax({
url: '/?json=get_category_posts&slug='+catSlugList[catIndex]+'&count=12&page='+pageNum+'&exclude=categories,type,url,title_plain,status,excerpt,comments,comment_count,comment_status,tags,attachments,modified,date,author',
success: function(data) {
$("#stylesDiv, #viewLargerDiv").empty();
pageMax = data.pages;
var $collectionDiv = $("#styleCollectionDiv").children("div:eq(1)");
var $showLargerDiv = $("#viewLargerDiv");
for(var i in data.posts){
$collectionDiv.append("<div class='singleStyle'>"+data.posts[i].content+"<p>"+data.posts[i].title+"</p></div>");
}
$showLargerDiv.append($collectionDiv.children("div:eq(0)").clone());
$("#stylesDiv .singleStyle").mouseenter( function(e){
$("#viewLargerDiv").empty().append($(this).clone());
});
$(".childrenUls a").removeClass("active");
$(".childrenUls a:eq("+catIndex+")").addClass("active");
}
});
return false;
});
$("#collectionNav p a").click( function(e){
if(this.getAttribute("href") === "#Back"){
if(pageNum===1){
if(catIndex === 0){
return
} else {
pageNum = 1;
catIndex--;
originalCat = catSlugList[catIndex];
$.ajax({
url: '/?json=get_category_posts&slug='+originalCat+'&count=12&page='+pageNum+'&exclude=categories,type,url,title_plain,status,excerpt,comments,comment_count,comment_status,tags,attachments,modified,date,author',
success: function(data) {
$("#stylesDiv, #viewLargerDiv").empty();
pageMax = data.pages;
var $collectionDiv = $("#styleCollectionDiv").children("div:eq(1)");
var $showLargerDiv = $("#viewLargerDiv");
for(var i in data.posts){
$collectionDiv.append("<div class='singleStyle'>"+data.posts[i].content+"<p>"+data.posts[i].title+"</p></div>");
}
$showLargerDiv.append($collectionDiv.children("div:eq(0)").clone());
$("#stylesDiv .singleStyle").mouseenter( function(e){
$("#viewLargerDiv").empty().append($(this).clone());
});
$(".childrenUls a").removeClass("active");
$(".childrenUls a:eq("+catIndex+")").addClass("active");
}
});
}
} else {
pageNum--;
$.ajax({
url: '/?json=get_category_posts&slug='+originalCat+'&count=12&page='+pageNum+'&exclude=categories,type,url,title_plain,status,excerpt,comments,comment_count,comment_status,tags,attachments,modified,date,author',
success: function(data) {
$("#stylesDiv, #viewLargerDiv").empty();
pageMax = data.pages;
var $collectionDiv = $("#styleCollectionDiv").children("div:eq(1)");
var $showLargerDiv = $("#viewLargerDiv");
for(var i in data.posts){
$collectionDiv.append("<div class='singleStyle'>"+data.posts[i].content+"<p>"+data.posts[i].title+"</p></div>");
}
$showLargerDiv.append($collectionDiv.children("div:eq(0)").clone());
$("#stylesDiv .singleStyle").mouseenter( function(e){
$("#viewLargerDiv").empty().append($(this).clone());
});
$(".childrenUls a").removeClass("active");
$(".childrenUls a:eq("+catIndex+")").addClass("active");
}
});
}
} else if(this.getAttribute("href") === "#More"){
if(pageNum===pageMax){
if(catSlugList.length-1 === catIndex){
return
} else {
pageNum = 1;
catIndex++;
originalCat = catSlugList[catIndex];
$.ajax({
url: '/?json=get_category_posts&slug='+originalCat+'&count=12&page='+pageNum+'&exclude=categories,type,url,title_plain,status,excerpt,comments,comment_count,comment_status,tags,attachments,modified,date,author',
success: function(data) {
$("#stylesDiv, #viewLargerDiv").empty();
pageMax = data.pages;
var $collectionDiv = $("#styleCollectionDiv").children("div:eq(1)");
var $showLargerDiv = $("#viewLargerDiv");
for(var i in data.posts){
$collectionDiv.append("<div class='singleStyle'>"+data.posts[i].content+"<p>"+data.posts[i].title+"</p></div>");
}
$showLargerDiv.append($collectionDiv.children("div:eq(0)").clone());
$("#stylesDiv .singleStyle").mouseenter( function(e){
$("#viewLargerDiv").empty().append($(this).clone());
});
$(".childrenUls a").removeClass("active");
$(".childrenUls a:eq("+catIndex+")").addClass("active");
}
});
}
} else if(pageNum < pageMax){
pageNum++;
$.ajax({
url: '/?json=get_category_posts&slug='+originalCat+'&count=12&page='+pageNum+'&exclude=categories,type,url,title_plain,status,excerpt,comments,comment_count,comment_status,tags,attachments,modified,date,author',
success: function(data) {
$("#stylesDiv, #viewLargerDiv").empty();
pageMax = data.pages;
var $collectionDiv = $("#styleCollectionDiv").children("div:eq(1)");
var $showLargerDiv = $("#viewLargerDiv");
for(var i in data.posts){
$collectionDiv.append("<div class='singleStyle'>"+data.posts[i].content+"<p>"+data.posts[i].title+"</p></div>");
}
$showLargerDiv.append($collectionDiv.children("div:eq(0)").clone());
$("#stylesDiv .singleStyle").mouseenter( function(e){
$("#viewLargerDiv").empty().append($(this).clone());
});
$(".childrenUls a").removeClass("active");
$(".childrenUls a:eq("+catIndex+")").addClass("active");
}
});
} else {
return false
}
}
return false;
});
});
</script>
<ul class="childrenUls">
<?php wp_list_categories('child_of=4&orderby=id&order=DESC&title_li='); ?>
</ul>
<?php } ?>
<br style="clear:both;" />
<div id="largeViewDiv">
<div><p>Place mouse over thumbnails to view larger.</p></div>
<div id="viewLargerDiv"></div>
</div>
<div id="styleCollectionDiv">
<div id="collectionNav"><p class="cMe"><a class="backButton" href="#Back">< Back</a><a class="moreButton" href="#More">More ></a></p></div>
<div id="stylesDiv"></div>
</div>
<br style="clear:both;" />
<?php } else { ?>
<?php the_content(); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'twentyeleven' ) . '</span>', 'after' => '</div>' ) ); ?>
<?php } ?>
</div><!-- .entry-content -->
<?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<br><br><br><span class="edit-link">', '</span>' ); ?>
答案 0 :(得分:1)
大多数Wordpress模板的CSS位于wp-content&gt; themes&gt; theme_name文件夹中,它几乎总是被称为style.css
如果我没记错的话,主题主文件夹中的header.php也引用了CSS。