- b2evolution CMS Support Forums
- b2evolution Support
- Templates, skins, XHTML and CSS
- [2.x] Converting Wordpress Themes
1 arunprasad Feb 26, 2009 14:55
My b2evolution Version: 2.x
Hi,
I have some problem when I try to convert a wordpress theme's index.php(which i later renamed to index.main.php).
The following is the problem:
I have managed to edit some part of the original index.php of the wordpress theme after renaming it into index.main.php. but I don't know how exactly to replace the main loop starting with "[u]foreach ($posts as $post) {[/u]" with the proper code as mentioned in the page "http://manual.b2evolution.net/Converting_WordPress_Themes"
So, I have now pasted the index.main.php file code of the wordpress theme that I wish to modify. Can anyone please exactly modify the code which I have posted below?
The script lines of the index.main.php is as follows, pls modify it for me:
<?php
// Emulate WordPress!! (Use this for development only!)
// Make sure you replace this with proper b2evolution markup before redistributing.
// Using this will NOT provide you with full b2evolution functionality!
skin_include( '_wp_compatibility.inc.php' );
// This is the main template; it may be used to display very different things.
// Do inits depending on current $disp:
skin_init( $disp );
// -------------------------- HTML HEADER INCLUDED HERE --------------------------
skin_include( '_html_header.inc.php' );
// Note: You can customize the default HTML header by copying the generic
// /skins/_html_header.inc.php file into the current skin folder.
// -------------------------------- END OF HEADER --------------------------------
// ------------------------- BODY HEADER INCLUDED HERE --------------------------
skin_include( '_body_header.inc.php' );
// Note: You can customize the default BODY header by copying the generic
// /skins/_body_footer.inc.php file into the current skin folder.
// ------------------------------- END OF FOOTER --------------------------------
?>
<div id="main-content" class="clearfix">
<div class="container">
<div class="col-580 left">
<?php
query_posts( 'showposts=2' );
if (have_posts()) :
while (have_posts()) : the_post(); $category = get_the_category();
?>
<div <?php post_class(); ?>>
<div class="post-meta clearfix">
<h3 class="post-title left"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
<p class="post-info right">
<span>By <?php the_author_posts_link(); ?></span>
<?php the_time( 'l F j, Y' ) ?>
</p>
</div><!-- End post-meta -->
<div class="post-box">
<div class="post-content">
<div class="comment-count">
<?php comments_popup_link(__( '0 Comments' ), __( '1 Comment' ), __( '% Comments' )); ?>
</div>
<?php if( get_post_meta( $post->ID, "image_value", true ) ) : ?>
<div class="post-image">
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><img src="<?php bloginfo( 'template_directory' ); ?>/timthumb.php?src=<?php echo get_post_meta( $post->ID, "image_value", true ); ?>&w=521&h=246&zc=1" alt="<?php the_title(); ?>" /></a>
</div>
<?php endif; ?>
<div class="post-intro">
<?php the_content( '' ); ?>
</div><!-- End post-intro -->
</div><!-- End post-content -->
<div class="post-footer clearfix">
<div class="continue-reading">
<a href="<?php the_permalink() ?>#more-<?php the_ID(); ?>" rel="bookmark" title="Continue Reading <?php the_title_attribute(); ?>">Continue Reading</a>
</div>
<div class="category-menu">
<div class="category clearfix">
<div><a href="#"><span class="indicator"></span> <?php echo $category[0]->cat_name; ?></a></div>
</div>
<div class="dropdown">
<ul class="cat-posts">
<?php
$posted = get_posts( "category=" . $category[0]->cat_ID );
if( $posted ) :
foreach( $posted as $post ) : setup_postdata( $posted );
?>
<li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a><span><?php the_time( ' F j, Y' ) ?></span></li>
<?php
endforeach;
endif;
?>
<li class="view-more"><a href="<?php echo get_category_link( $category[0]->cat_ID ); ?>" class="view-more">View More »</a></li>
</ul>
</div><!-- End dropdown -->
</div><!-- End category -->
</div><!-- End post-footer -->
</div><!-- End post-box -->
</div><!-- End post -->
<?php
endwhile;
endif;
?>
<?php
query_posts( 'showposts=4&offset=2' );
if (have_posts()) : $counter = 0;
while (have_posts()) : the_post(); $category = get_the_category();
if( $counter % 2 == 0 )
$end = "";
else
$end = "last";
?>
<div <?php post_class( 'single ' . $end ); ?>>
<div class="post-meta clearfix">
<h3 class="post-title left"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
</div><!-- End post-meta -->
<div class="post-box">
<div class="post-content">
<div class="comment-count">
<?php comments_popup_link(__( '0 Comments' ), __( '1 Comment' ), __( '% Comments' )); ?>
</div>
<?php if( get_post_meta( $post->ID, "image_value", true ) ) : ?>
<div class="post-image">
<img src="<?php bloginfo( 'template_directory' ); ?>/timthumb.php?src=<?php echo get_post_meta( $post->ID, "image_value", true ); ?>&w=235&h=109&zc=1" alt="<?php the_title(); ?>" />
</div>
<?php endif; ?>
<div class="post-intro">
<?php the_excerpt( '' ); ?>
</div><!-- End post-intro -->
</div><!-- End post-content -->
<div class="post-footer clearfix">
<div class="continue-reading">
<a href="<?php the_permalink() ?>#more-<?php the_ID(); ?>" rel="bookmark" title="Continue Reading <?php the_title_attribute(); ?>">Continue Reading</a>
</div>
</div><!-- End post-footer -->
</div><!-- End post-box -->
</div><!-- End post -->
<?php
// Clear the left float to allow for different heights
if( $counter % 2 != 0 )
echo'<div style="clear:left;"> </div>';
?>
<?php
$counter++;
endwhile;
endif;
?>
<br />
<?php
query_posts( 'showposts=6&offset=6' );
if (have_posts()) :
while (have_posts()) : the_post(); $category = get_the_category();
?>
<div <?php post_class( ); ?>>
<div class="post-meta clearfix">
<h3 class="post-title-small left"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
<p class="post-info right">
<span>By <?php the_author_posts_link(); ?></span>
<?php the_time( 'l F j, Y' ) ?>
</p>
</div><!-- End post-meta -->
</div><!-- End archive -->
<?php
endwhile;
endif;
?>
</div><!-- End col-580 (Left Column) -->
<div class="col-340 right">
<ul id="sidebar">
<?php get_sidebar(); ?>
</ul><!-- End sidebar -->
</div><!-- End col-340 (Right Column) -->
</div><!-- End container -->
</div><!-- End main-content -->
<?php
// ------------------------- BODY FOOTER INCLUDED HERE --------------------------
skin_include( '_body_footer.inc.php' );
// Note: You can customize the default BODY footer by copying the
// _body_footer.inc.php file into the current skin folder.
// ------------------------------- END OF FOOTER --------------------------------
?>
<?php
// ------------------------- HTML FOOTER INCLUDED HERE --------------------------
skin_include( '_html_footer.inc.php' );
// Note: You can customize the default HTML footer by copying the
// _html_footer.inc.php file into the current skin folder.
// ------------------------------- END OF FOOTER --------------------------------
?>
Thank you!
3 arunprasad Feb 27, 2009 05:40
Hi Afwas,
Thank you!
Here is the link to the zip file of the wordpress theme skin which I wish to convert for b2evolution.
http://www.arunprasad.info/blogs/skins/magazeen-wordpress-theme.zip
4 afwas Feb 27, 2009 16:06
I'll see what I can do.
Hi arunprasad,
Welcome to the forums.
Can you zip up the WP files for me (and make available through a link) and I'll have a look this weekend.
Good luck