Get certain number posts

<?php $posts = get_posts( “category=1&numberposts=10″ ); ?>
<?php if( $posts ) : ?>
<ul><?php foreach( $posts as $post ) : setup_postdata( $post ); ?>
<li>
<a href=”<?php the_permalink() ?>” rel=”bookmark” title=”<?php the_title(); ?>”><?php the_title(); ?></a>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?> 

 category=1&numberposts=10, means category 1, and list 10 posts

add the code at your wordpress homepage, you blog will looks more great.

if you change numberposts=10 to -1, it will show all posts under the category.

Posted in WordPress. Comments Off on Get certain number posts »

WordPress Permalinks Does Not Work in xampp Setup

xampp provides a convenient way to quickly and easily install and setup a web server that works without much configuration. However, permalinks feature won’t work with the default installation of xampp, even though you can properly customize the permalinks structure to create the .htaccess file. (more…)

Posted in Apache, WordPress. Comments Off on WordPress Permalinks Does Not Work in xampp Setup »

No Sidebars Defined

This should work. In sidebar.php, add this just after the first < ul > :

Add this just before the last < /ul > :

Now create a new, blank page in your editor and save it as functions.php . Place this on the new functions.php page:

Upload functions.php and sidebar.php to the theme folder. Your sidebar should now be widgetized.

Posted in WordPress. Comments Off on No Sidebars Defined »

list all posts

<h3>Posts</h3>
<ul>

                <?php while(have_posts()) : the_post(); ?>

<?php foreach((get_the_category()) as $category)
                          { $my_query = new WP_Query(‘category_name=’ . $category->category_nicename . ‘&orderby=title&order=asc&showposts=100’);} ?>

                       <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>

       <li><a href=”<?php the_permalink(); ?>” title=”<?php the_title(); ?>”><?php the_title(); ?></a></li>

                      <?php endwhile; ?>

<?php break; endwhile; ?>

</ul>

Posted in WordPress. Comments Off on list all posts »

How to control the tag cloud font size?

Just add the following code at any place you need to let the tag show:

if ( function_exists(‘wp_tag_cloud’) ) :

  • KingPHP.com Tags

      wp_tag_cloud(‘smallest=8&largest=8’);

 

Posted in WordPress. Comments Off on How to control the tag cloud font size? »

Host 2 domains for the same wordpress database.

Q:Me and a friend are trying to make http://kingphp.com and www.chinascience.org the same… I hosted his domain on my hosting as an add-on domain. (more…)

Posted in WordPress. Comments Off on Host 2 domains for the same wordpress database. »

Mass Post Manager for WordPress

This plugin performs the following tasks:

Delete all posts and/or comments in selected category
Move all posts from one category to another
Plugin was developed for may needs so its functionality is quite limited right now. However i plan to add more and more features to Mass Post Manager (more…)

Posted in WordPress. Comments Off on Mass Post Manager for WordPress »
King Php Science Welcome, you are from: 54.146.11.8