Skip to main content
We are Brand SEO Beijing serving international business, your marketing partner, Contact us by mi@mgsh.com.cn

Commonly used calling codes for website development

Commonly used calling codes for website development
1. Get a list of page categories


2. Get the article image link

ID)); echo $url; ?>

3. Obtain the root domain name of the website


4. Get the article content single page
(1) Select page template according to article classification


(2) Content page call

title:author:release time:viewing count:content:

5. Set the relative path of the website
6. Modify the image upload and automatically change the name
7. Get custom fields

p >= field name: ID, "ziduan", true); ?>

8. Get the category page list directory
9. The article content page gets the previous and next code

      
      

10. Get a list of categories
Get a list of Page categories

Get a list of cat categories  parent); // output parent category link //echo get_category_link($parentCat->term_id); $cat = get_category($parentCat->term_id); echo ' term_id).'">'; echo $cat->name; echo ' '; } ?>

11. Get the title of the article

post_title; echo $title;//Output the title of the article?>

12. Get the title and content of the fixed page

post_title; // title?>  post_content); //Content?>

13. Get the title according to the category ID


14. Get Navigation NAV

'div', //the outermost container label name 'container_class' => 'nav', //the outermost container class name 'menu' => 'creator menu', 'theme_location' => 'primary', ' menu_id' => '') ); ?>

15. Call NAV classification description
Add the following code to functions!

//menu class description_walker extends Walker_Nav_Menu { function start_el(&$output, $item, $depth=0, $args=array(),$id=0) { global $wp_query; $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; $class_names = $value = ''; $classes = empty( $item->classes ) ? array() : (array) $item->classes; $class_names = join ( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) ); $class_names = ' class="'. esc_attr( $class_names ) . '"'; $output .= $indent . ' ID . '"' . $value . $class_names .'> '; $attributes = ! empty( $item->attr_title ) ? ' title="' . esc_attr( $item->attr_title ) .'"' : ''; $attributes .= ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : ''; $attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : ''; $attributes .= ! empty( $item->url ) ? ' href="'%20%20%20.%20esc_attr(%20$item->url%20%20% 20%20%20%20%20%20)%20.'"' : ''; $prepend = ''; $append = ''; $description = ! empty( $item->description ) ? ' '.' '.esc_attr( $item->description ).' ' : ''; if($depth != 0) { $description = $append = $prepend = ""; } $item_output = $args->before; $item_output .= ' '; $item_output .= $args->link_before .$prepend.apply_filters( 'the_title', $item->title, $item->ID ).$append; $item_output .= ' '; $item_output .= $args ->after; $item_output .= $description.$args->link_after; $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args ); } }

16. Get the name of the current category list

name;?>

17. Go back to the current category list description

description;?>

18. Get the category list under the current article

term_id; ?>-posts"> name; ?> term_id); foreach($posts as $post) : ?>

19. Obtain classification information through aliases

name; ?> //You can view all classification information with var_dump and get it by object!

 
Copyright statement: This article is an original article by the CSDN blogger "Landi Network" and follows the CC 4.0 BY-SA copyright agreement. Please attach the original source link and this statement for reprinting.Original link: blog.csdn.net/fengqiangjun/article/details/51884211

Back to Top