WordPress: Ua Lub Tsev Sab Hauv Hauv 3 Kauj Ruam Yooj Yim

wordpress logo

Kuv tau ua haujlwm ntawm lub xaib rau tus phooj ywg niaj hnub no uas muaj WordPress tab sis nws xav tau lub qhov home page uas yooj yim dua li qhov home page siv tawm tswv yim tshiab hauv blog.

This is really useful if you'd like your blog to be a part of your site rather than the entire site. You can basically utilize WordPress as a CMS. Below I concentrated on ‘3 Easy Steps' so if you're an advanced developer who utilizes WordPress, don't give me a lot of guff. 🙂

Some people really go through some difficult steps to do this, but there really is a simple way… here's how using the default theme:

  1. Luam koj Cov Ntawv Nplooj (page.php) rau cov ntawv tshiab hu ua home.php thiab muab nws tso rau hauv koj cov ntawv cim npe. Qhov no yog qhov txhawb ntawm WordPress… nws yuav nrhiav ev.php thawj yog tias nws muaj.
  2. Make a new Category and call it Home Page. Remember the Category ID number… you'll need it in the following code.
  3. Overwrite Lub voj in home.php with the code below. This basically filters out any other content except the content posted to your new Category called Home Page. Be sure to substitute the Category ID below in the quotes in the cat=1 statement. I also asked to sort the posts ascending since that's more appropriate.

That's it! You're done! If you only want a single article on that page, just write one post and update it whenever you wish to update your home page! Voila!

<?php query_posts('cat=1&order=ASC'); // include home page only and sort ascending ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h2><?php the_title(); ?></h2>
<div class="entry">
<?php the_content('<p class="serif">Read the rest of this page »</p>'); ?>
<?php link_pages('<p>>strong>Pages:</strong> ', '</p>', 'number'); ?>
</div>
</div>
<?php endwhile; endif; ?>

If you'd like a plugin for assisting in making a home page, you can utilize qhov no yog ib.

4 Comments

  1. 1
  2. 2

    Kuv tsis muaj tus kws tshaj lij flash, Ashish… tab sis koj twv yuav raug tsim muaj cov txaws nyem nplooj ntawv uas pib hloov mus rau koj lub blog lossis muaj qhov txuas rau koj cov blog hauv koj cov ntawv flash.

  3. 3
  4. 4

Yuav ua li cas koj xav hais tias?

Qhov Web site no siv Akismet los txo cov kev pabcuam. Kawm li cas koj cov ntaub ntawv tawm tswv yim tiav.