Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Oct 2009
    Location
    GERMANY
    Posts
    139
    Thanks
    29
    Thanked 1 Time in 1 Post

    having trouble inserting functions (wordpress)

    What's up guys,

    so far I've created the basic structure for a wordpress theme, however, when I want to insert the functions of the original theme into mine, things don't really work. I'm kind of lost here. This is how it looks right now:

    http://craiglist.kilu.de/

    here's the index file:

    Code:
    <?php
    require_once dirname( __FILE__ ) . '/form_process.php';
    get_header( ); 
    include_classified_form( );
    ?>
    
    	<div class="content">
    	
    		<ul id="catnav">
                <li<?php if ( is_home() ) { echo " class=\"current-cat\""; } ?>><a href="<?php bloginfo('url'); ?>" ><?php _e('Latest Listings','cp'); ?></a></li>
    			<?php wp_list_categories('show_count=0&hide_empty=0&orderby=name&order=asc&title_li='); ?>
    			<li><div class="clear"></div></li>
            </ul>
    		
    		<?php if ( is_category() && function_exists('bcn_display')) { ?>	
    			<div class="subnav">
    				<small><?php if(function_exists('bcn_display')) { bcn_display(); } ?></small>
    			</div>
    		<?php } ?>
    		
    		<div class="main">
    		
    			<div class="listing">
    				<div class="head">
    				
    					<span class="name">
    					<?php _e('Item Name','cp'); ?>
    					<a href="?sort=title&order=asc"><img src="<?php bloginfo('template_url'); ?>/images/sortup.gif" border="0" /></a><a href="?sort=title&order=desc"><img src="<?php bloginfo('template_url'); ?>/images/sortdown.gif" border="0" /></a>
    					</span>
    					
    					<span class="price">
    					<?php _e('Price','cp'); ?>
    					<a href="?sort=meta_value&key=price&order=asc"><img src="<?php bloginfo('template_url'); ?>/images/sortup.gif" border="0" /></a><a href="?sort=meta_value&key=price&order=desc"><img src="<?php bloginfo('template_url'); ?>/images/sortdown.gif" border="0" /></a>
    					</span>
    					
    					<span class="location">
    					<?php _e('Location','cp'); ?>
    					<a href="?sort=meta_value&key=location&order=asc"><img src="<?php bloginfo('template_url'); ?>/images/sortup.gif" border="0" /></a><a href="?sort=meta_value&key=location&order=desc"><img src="<?php bloginfo('template_url'); ?>/images/sortdown.gif" border="0" /></a>
    					</span>
    					
    					<span class="date">
    					<?php _e('Posted','cp'); ?>
    					<a href="?sort=date&order=asc"><img src="<?php bloginfo('template_url'); ?>/images/sortup.gif" border="0" /></a><a href="?sort=date&order=desc"><img src="<?php bloginfo('template_url'); ?>/images/sortdown.gif" border="0" /></a>					
    					</span>
    					
    					<div class="clear"></div>
    				</div>
    				<div class="list">
    					<?php 
    					$i = 1; 
    					
    					if(!empty($_GET['sort']))
    					{
    					$orderby=trim($_GET['sort']);
    					$order=trim($_GET['order']);
    					$key=trim($_GET['key']);
    					
    					// create the sort by injection
    					$posts = query_posts($query_string . '&orderby='.$orderby.'&meta_key='.$key.'&order='.$order.'');
    					}
    					
    					if (have_posts()) : ?>
    					
    					<?php while (have_posts()) : the_post(); ?>
    					
    					<?php if ($i % 2 == 0) { $alt = " class=\"alt\""; } else { $alt = " class=\"no\""; } echo "<div" . $alt;
    					if (is_sticky()) { echo " id='sticky' "; } echo ">"; 
    					?>
    						
    					<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
    									
    					<?php if ( get_option('main_page_img') != "no" ) { ?>
    
    						<span class="image">	
    							<?php $images = get_post_meta($post->ID, "images", true);
    								if (empty($images)) {?>
    								    <div class="main_page_no_img"><img src="<?php bloginfo('template_url'); ?>/images/no-pic.png" alt="No Photo" border="0" /></div></span>
    								<?php } else { ?>
    								<div class="main_page_img" style="background: #FFF url(<?php echo get_bloginfo('template_url')."/includes/img_resize.php?width=50&height=50&url=";?><?php
    										  if ( strstr($images, ',')) {  
    											$matches = explode(",", $images);
    											$img_single = $matches[0];
    											$img_single = explode(trailingsla****(get_option('siteurl')) . "wp-content/uploads/classipress/", $img_single);
    											echo $img_single[1];
    										  } else {
    											$img_single2 = $images;
    											echo $img_single2;
    												}?>) center no-repeat"></div></span>
    								<?php 
    								} 
    									} else {
    										$ii = 1;
    										echo "<span class='cat_image'>";
    										foreach((get_the_category()) as $category) {
    											if ($ii == "1") {
    												$cat_image = get_bloginfo('template_url')."/images/category-icons/".get_option("cat$category->cat_ID").".png";
    												echo "<img src=" . $cat_image . ">";
    												$ii++;
    											}
    										}
    										echo "</span>";
    									} ?>
    								
    								<span class="item"><div style="text-decoration:underline; font-weight:bold;"><?php if ( strlen(get_the_title()) > 65 ) { echo substr(get_the_title(), 0, 65)."..."; } else { the_title(); } ?></div>
    								<?php echo substr(strip_tags($post->post_content), 0, 190)."...";?></span>
    								<span class="price"><?php echo get_option('currency'); ?><?php echo get_post_meta($post->ID, "price", true); ?></span>
    								<span class="location"><?php echo get_post_meta($post->ID, "location", true); ?></span>
    								<span class="date"><?php echo classi_time($post->post_date); ?></span>
    							</a>
    							<div class="clear"></div>
    						</div>
    						
    					<?php $i++; unset($alt); ?>
    					
    					<?php endwhile; ?>
    					
    
    						<div class="navigation1">
    						<div class="navigation2">
    						
    						<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } else {  ?>
    						
    							<div class="alignleft">
    								<?php next_posts_link('<div class="next_post_link"></div>') ?>
    							</div>
    							<div class="alignright">
    								<?php previous_posts_link('<div class="previous_post_link"></div>') ?>
    							</div>
    							
    						<?php  } ?>
    						
    						</div>
    						<div style="clear:both;"></div>
    						</div>
    					<div style="clear:both;"></div>
    					
    					<?php endif; ?>
    					
    				</div>
    			</div>
    		</div>
    	</div>
    	
    <?php
    //code to prune posts.
    if (get_option("post_prun") == "yes" && get_option("prun_period") != "" && get_option("post_prun") != "") {
    	$prun_period = get_option("prun_period");
    	$sql = "SELECT `ID` FROM $wpdb->posts WHERE `post_date`<'".date('Y-m-d h:i:s', strtotime("-$prun_period days"))."' AND `post_status`='publish' AND `post_type`='post' LIMIT 10";
    	$sql = mysql_query($sql);
    	while ($row=mysql_fetch_array($sql)){
    		$post_id = (int)$row['ID'];
    
    		if (get_option("prun_status") == "1") {
    			$my_post = array();
    			$my_post['ID'] = $post_id;
    			$my_post['post_status'] = 'draft';
    			wp_update_post( $my_post );
    		} else if (get_option("prun_status") == "2") {
    			wp_delete_post($post_id);
    		}
    	}
    }
    ?>	
    	
    <?php get_footer(); ?>
    This is my theme:

    http://derderder.cwsurf.de/

    And here's the index file:

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Unbenanntes Dokument</title>
    <style>
    body { background-color:#F3F6F2; margin: 0; }
    #top-wrap { width: 100% }
    #header { width: 960px; height: 110px; background-color:FFFFFF; margin:0 auto; }
    #navwrap { width: 960px; background-color:#FFFFFF; margin: 0 auto; }
    #nav { width: 940px; height: 42px; background-color:E0E5EF; margin: 0 auto; }
    #signpost { width: 960px; height: 30px; background-color:FFFFFF; margin: 0 auto; }
    #wrap { width: 100%; }
    #adspace { width: 960px; margin: 0 auto; background-color: FFFFFF; }
    #middle { width: 960px; background-color:FFFFFF; margin: 0 auto; }
    #footer { width:960px;  background-color:FFFFFF; margin:0 auto; }
    
    
    </style>
    </head>
    
    <body>
    <div id="top-wrap">
    	<div id="header">
    		this is the header
    	</div>
    	<div id="navwrap">
    	<div id="nav">
    		this is the nav
    	</div>
    	</div>
    	<div id="signpost">
    		this is the signpost
    	</div>
    </div>
    <div id="wrap">
    	<div id="adspace">
    		this is google ad space
    	</div>
    	<div id="middle">
    		this is the middle
    	</div>
    </div>
    <div id="footer">
    	this is the footer 
    </div>
    </body>
    </html>
    For example, once I copy what's under "catnav" into my "nav", it doesn't look right..... I'm really confused.....

  • #2
    Senior Coder
    Join Date
    Feb 2009
    Location
    Ilkley, West Yorkshire, UK
    Posts
    2,955
    Thanks
    9
    Thanked 726 Times in 720 Posts
    I'm not quite clear exactly what your question is here.

    Are you saying you're trying to insert some of the php in your top code into the bottom code? If so can you post the resultant code here?

    And when you say it doesn't look right - can you be more specific?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •