WordPress.org

Ready to get started?Download WordPress

Forums

when adding new or updating posts, content is overwritten with other another pos (2 posts)

  1. ridinglowest
    Member
    Posted 3 years ago #

    Very wiered!!

    I have installed, moved, and worked on many wordpress projects and of cource on my website I come across a weird issue. after developing my site on my local server I updated to wordpres 3.01 from 2 something. Worked fine so I moved it to my live web server changed all urls in db etc. and noiw the issue

    Anytime you update a post, doesn't matter if you are adding a new post or editing an old post. It over rights the content with one of my older posts and is always the same post content that it uses. No matter what.

    Any suggestions??

  2. ridinglowest
    Member
    Posted 3 years ago #

    No replies so last night I deleted my wordpress installation and started over..

    After importing content, uploading template files, images etc. I tried again and was able to isolate the the issue to my shortcode function. But this worked fine in ver 2.6 and now in 3.0 has issues but posts that came from my prievious installation still work and they have my shortcode.

    Any Ideas

    // [myrelatedProjects jskey="Flash,Control System"]
    function myrelatedProjects2($atts) {
    
    	extract(shortcode_atts(array( "jskey" => '' ), $atts));
    
    	$dablogurl = get_bloginfo("wpurl");
    	$jstags = $jskey;
    	$jshtml = "<p style='margin-left:20px;'>";
    	$jsstep = 4;
    	//--- now lets pull 5 projects with the same tags ------------------>>
    
    		$getjsPosts = new WP_Query("cat=95,97,94&tag=".$jstags."&post_type=post&orderby=date&order=ASC");
    		while($getjsPosts->have_posts()) : $getjsPosts->the_post();
    
    			$dapostid = get_the_ID();
    			$jsImageUrl3 = get_post_meta($dapostid, 'imageSlider', true);
    			$jsPostUrl = get_permalink($post->ID);
    
    			//
    			$jsImageUrl4 = explode(".", $jsImageUrl3);
    			$jsImageUrl = explode("-", $jsImageUrl4[0]);
    			$jsImageUrl2 = "";
    			$jsImageAlt = get_the_title($post->ID);
    
    			for ($jstemp=0; $jstemp<=sizeof($jsImageUrl)-2; $jstemp++){ $jsImageUrl2 .= $jsImageUrl[$jstemp] . "-"; }
    
    			if ( $jsImageUrl2 == "" ){ $jsImageUrl2 = $jsImageUrl4[0] . "-"; }
    
    			$jsImageUrl2 .= "100x100.jpg";
    			$jsstep--;
    
    			if ($jsstep >= 0){
    			$jshtml .= '<a class="view" href="'.$jsPostUrl.'">
    							<img class="daborder2" style="margin-left: 5px;" src="'.$dablogurl.'/wp-content/uploads/'.$jsImageUrl2.'" alt="'.$jsImageAlt.'" width="100" height="100" />
    						</a>';
    			}
    
    			/*if ($jsstep == 0){ }*/
    
    		endwhile;
    
    	$jshtml .= "</p>";
    
    	return $jshtml;
    
    }
    
    add_shortcode('myrelatedProjects', 'myrelatedProjects2');

Topic Closed

This topic has been closed to new replies.

About this Topic