Wordpress and theme

Source: Internet
Author: User
Tags php template

 

Get the blog homepage:

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

 

 

 

Get the CSS file location in the template, and the image location.

<Link href = "<? Php bloginfo ('template _ directory');?> /Favicon. ico "rel =" shortcut icon "type =" image/x-icon "/>

/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/TER ', $ in_footer );
}

 

 

 

 

 

 

 

 

Related information

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 ()

 

 

 

 

Common labels (loops)
<? Php wp_list_pages ('title _ li = ");?>

 

 

<? Php wp_get_archives ('Type = monthly ");?>

 

Wp_list_categories

 

 

 

Show articles under a specific category
<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-related labels

Bloginfo ()Such as bloginfo ("name ");

Wp_title () wp_title ("-", true ,"");

The_title () the_title ("

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

 

 

 

Predefined 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 except des the alignment class from abve 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. 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 () ;?>>

 

 

 

Custom

 

Activity

Creating a custom page template

 

Creating a second sidebar

 

 

Creating a custom page. php template file

 

 

Custom category page:

Category-2.php

 

The problem is how to define custom content pages and tabs on the custom category page.

 

Custom Headers

Creating custom header, footer, sidebar includes

 

 

Multimedia Processing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.