Wordpress and Webdesign Forum go41 » WordPress Code Snippets

  1. To get a plain page between header and footer in arthemia theme to display a forum you have to create a page template for Wordpress first. I just took page.php, which actually has this content:

    <?php get_header(); ?>
    
     <div id="content">
    
     <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
     <div class="post" id="post_<?php the_ID(); ?>">
    
     <span class="breadcrumbs"><a href="<?php echo get_option('home'); ?>/">Home</a> &raquo; <?php the_title(); ?></span>
    
     <h2 class="title"><?php the_title(); ?></h2>
    
      <div class="entry clearfloat">
      <?php the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?>
    
      <?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
    
      </div>
    
     <?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
    
     </div>
    
     <div id="comments">
     <?php comments_template(); ?>
     </div>
    
     <?php endwhile; endif; ?>
    
     </div>
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    You add to the top of the file the remark to be a template for your theme, like this:

    <?php
    /*
    Template Name: forum as page
    */
    ?>

    You can safely delete all calls for the content as there will be your forum.
    To come to the point: Create a new template named forumpage.php with the following content:

    <?php
    /*
    Template Name: forum as page
    */
    ?>
    <?php get_header(); ?>
    
    <div id="forum" style="height: 500px;">
    HERE COMES YOUR FORUM, no styling except some height to have not only one line..
    </div>
    
    <?php get_footer(); ?>

    load this via ftp into your themes folder (wp-content/themes/arthemia/).

    Log into your Wordpress Dashboard and click on Pages - Add New.

    Just give this page any name (Forum) and select under Attributes Template the new template you created, here: forum as page

    No need to put any content as it will not be displayed - so safe now and look if you got a new page in your navigation bar. Click it and you will see your header, a blank unformatted space with 'HERE COMES YOUR FORUM...' and below the footer as it should be.

    How to display and format which forum is now up to you, just replace the line with 'HERE COMES YOUR FORUM...' with the call or iframe for the forum.

    Posted 2 years ago #
  2. Simple:Press Forum - I got the hint that if you use the Simple:Press Forum Plugin you still need to keep the call to <?php the_content(); ?> inside the template.

    It should finally look like this:

    <?php
    /*
    Template Name: forum as page
    */
    ?>
    <?php get_header(); ?>
    	<div id="fullforum">
    		<?php the_content(); ?>
    		<div class="clearer">&nbsp;</div>
    	</div>
    <?php get_footer(); ?>

    Simple:Press Forum should use the full width of your blog's space without the sidebar. You can adjust the styling in your themes style.css or the forum's css.

    Posted 2 years ago #

RSS feed for this topic

Reply

You must log in to post.

Join us! or log in (lost password?):