我正在爲一個朋友業務做一些編輯工作,而wordpress模板是以一種非常古老的方式編寫的。我已經知道大部分代碼是如何工作的,但是我所知道的一件事是文件引用的是它沒有以任何常用方式導入它的css信息,並且它沒有使用主要的wordpress主題css文件。我無法在螢火蟲中找到資源。任何人都可以幫助我理解此代碼的工作原理我專門試圖訪問singleStyle div的CSS信息CSS文件在php模板中的位置
網址: 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>'); ?>
Firebug說文件名是style.css。如果你有shell訪問根目錄並運行'find。 -name style.css' – Codeguy007
或者按照Codeguy007 –