WordPress.org

Ready to get started?Download WordPress

Forums

Creating a blog that has seperate codes from rest of website (4 posts)

  1. tikitourmoto
    Member
    Posted 5 years ago #

    Hi all,

    I would like the blog on my website to have different properities from the rest of my pages.
    Although it would have the same theme, and look, I want things like the sidebar etc. to have different properties such as have a calender, archives, catagories etc. etc. while I only want my static pages to display search, recent posts and maybe one or two other things.

    How do I do this and what should I be looking at? Do I need to create a second mySQL and wordpress database for my blog or is there some other way?

    Kind regards
    Nicole

  2. MichaelH
    Member
    Posted 5 years ago #

    No you don't need a 2nd database, but you will want to first become familiar with the WordPress Template Hierarchy. Once you understand that you would likely be changing your Tempate file sidebar.php, you will want to understand some Conditional Tags, in particular the is_page conditional.

    Example:

    <?php if (is_page('2')) { ?>
      <li><h2>Archives</h2>
      <ul>
      <?php wp_get_archives('type=monthly'); ?>
      </ul>
      </li>
    <?php wp_list_categories('show_count=1&title_li=<h2>Categories</h2>'); ?>
    <?php } ?>
    <?php if (is_page('109')) { ?>
      <li><h2>Recent Posts</h2>
      <ul>
      <?php wp_get_archives('type=postbypost&limit=6'); ?>
      </ul>
      </li>
    <?php get_calendar(); ?>
    <?php } ?>

    Related:
    Category:WordPress_Lessons
    Category:Design_and_Layout

  3. tikitourmoto
    Member
    Posted 5 years ago #

    Great thanks!!

    I'll start having a read through all of that - found so much conflicting advice online didn't know where to start and what to read!

    Kind regards
    Nicole

  4. MichaelH
    Member
    Posted 5 years ago #

    Let me also introduce you to WordPress Backups because if you follow those instructions, you will always be protected, no matter what you do to your blog programming wise.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags