wp 知识点备忘

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/liu709127859/article/details/82254716

add_filter('pre_option_link_manager_enabled','__return_true'); 后台注册链接选项

wp_list_bookmarks()获取友情链接

get_template_directory()是返回主题的绝对路径
get_template_directory_uri() 返回主题uri

bloginfo('template_directory');返回主题uri

wp_nav_menu( array( 'theme_location' => 'primary' , 'container_class' => 'menu') ); 获取导航菜单,参数指定一些导航样式

get_posts( "category=1&numberposts=8" ); 获取 所有文章

<ul>

<?php $posts = get_posts( "category=1&numberposts=8" ); ?>

<?php if( $posts ) : ?>

<?php foreach( $posts as $post ) : setup_postdata( $post ); ?>

<li><span><?php the_time('m-d'); ?></span><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php echo cut_str($post->post_title,38); ?></a></li>

<?php endforeach; ?>

<?php endif; ?>

</ul>

猜你喜欢

转载自blog.csdn.net/liu709127859/article/details/82254716