wordpress and theme

來源:互聯網
上載者:User

 

得到部落格的首頁:

<?php echo home_url( '/' ); ?>

 

 

 

得到模板中的CSS檔案位置,image 圖片的位置

<link href="<?php bloginfo('template_directory'); ?>/favicon.ico" rel="shortcut icon" type="image/x-icon" />

<img  src="<?php bloginfo('template_directory'); ); ?>/image/wordpress.png title=”good template” />

 

<?php wp_enqueue_script("jquery"); ?>

 

<script type="text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/js/my-theme.js"></script>

 

 

 

wp_enqueue_script( 'featured-slider', get_bloginfo('stylesheet_directory') . '/js/featured-slider.js', array( 'jquery', 'jquery-uicore','jquery-ui-tabs' ) );

 

if( !is_admin() ) {
wp_enqueue_script( 'my-theme', get_bloginfo('stylesheet_directory') .'/js/my-theme.js', $in_footer);
}

 

 

 

 

 

 

 

 

相關資訊

post-<?php the_ID(); ?>">

<?php the_permalink() ?>">

<?php the_title();  ?>

the_category(", ")?>  

the_content()

the_author_meta()

next_post_link()   next_post_link("<strong>%title</strong>");

comments_number()

 

 

 

 

常用的標籤(迴圈)
<?php wp_list_pages('title_li=" ); ?>

 

 

<?php wp_get_archives('type=monthly"); ?>

 

wp_list_categories

 

 

 

顯示特定的類別下的文章
<ul class='tocNav">
<?php
global $post;
$myposts = get_posts("numberposts=5&category=3");
foreach($myposts as $post):
setup_postdata($post);
?>
<li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
</ul>
<!—//end recent

 

 

 

SEO相關的標籤

bloginfo() 如  bloginfo("name");

wp_title()wp_title("—",true,"");

the_title()    the_title("<h2>", "</h2>");

the_content()  the_content("more_link_text", strip_teaser, "more_file");

 

 

 

預定義的CSS

.aligncenter: This style is generated if you select Center. A good way to ensure this style is centered is:

.alignleft

.alignright:

 

 

div.aligncenter {
display: block;
margin-left: auto;
margin-right: auto;
}

 

.alignleft {
float: left;
}

.alignright {
float: right;
}

 

 

In addition to the alignment, if you choose to write a caption for your image

.wp-caption: Wraps the image and the caption text in a div which also includes the alignment class from above if you selected one.

.wp-caption-text: Wraps the specific text in a p tag with this class assigned. This class appears inside the outer div with the .wp-caption class assigned to that div, like so:

 

 

Classes output by the sidebar widgets
The following classes are output by the various default widgets available in WordPress:

.widget: If you use the standard function to register a sidebar and "widigtize" your theme, this class will be appended to every <li> tag produced by a widget. You can customize the register sidebar function so that this class will not appear.

.textwidget: This class is added to text generated by the Text widget.

.blogroll: This class is generated by the Links widget (your blogroll).
It is added to the main ul wrapper.

.linkcat: This class is added to the <li> of every link that has a href link for a category.

 

 

Classes output by the wp_list_pages template tag

.page_item: This is applied to each list item tag in a page list (even page lists generated by the Page widget)

.current_page_item: This class is assigned to the currently selected page.

.current_page_parent: If the currently selected page has a parent page, that parent will have this class appended to it.

.current_page_ancestor

 

Classes output by the wp_list_categories template tag

.cat-item: This is applied to each li item in a category listing

.current-cat-parent: If a category is nested and selected, this will display in the li item of that parent

 

 

body_class class styles

<body <?php body_class(); ?>>

 

 

 

自訂

 

活動

Creating a custom page template

 

Creating a second sidebar

 

 

Creating a custom page.php template file

 

 

自訂的類別頁面:

category-2.php

 

問題是如何在自訂的類別頁面中定義自訂的內容頁,標籤頁等

 

自訂的頭部等

Creating custom header, footer, sidebar includes

 

 

對於多媒體類型的處理

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.