Creating default object from empty value

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • Creating default object from empty value

    Hallo ich bin neu hier und habe ein Fehler auf meiner Webseite aber iwi komme ich nicht weiter...
    Creating default object from empty value in /shortcodes.php on line 616
    Code:
    add_shortcode('recent_posts', 'shortcode_recent_posts');
    function shortcode_recent_posts($atts, $content = null) {
    	$attachment = '';
    	$html = '<div class="container">';
    	$html .= '<section class="columns" style="width:100%">';
    	$html .= '<div class="holder">';
    	$recent_posts = new WP_Query('showposts=3');
    	$count = 1;
    	while($recent_posts->have_posts()): $recent_posts->the_post();
    	if($count == 3) {
    		$html .= '<article class="col last">';
    	} else {
    		$html .= '<article class="col">';
    	}
    	if($atts['thumbnail'] == "yes"):
    	[COLOR="Red"][U]$post->ID = get_the_ID();[/U][/COLOR]
    	$args = array(
    	    'post_type' => 'attachment',
    	    'numberposts' => '5',
    	    'post_status' => null,
    	    'post_parent' => $post->ID,
    		'orderby' => 'menu_order',
    		'order' => 'ASC',
    		'exclude' => get_post_thumbnail_id()
    	);
    	$attachments = get_posts($args);
    	if($attachments || has_post_thumbnail() || get_post_meta($post->ID, 'pyre_video', true)):
    	$html .= '<div class="flexslider floated-post-slideshow">';
    		$html .= '<ul class="slides">';
    			if(get_post_meta($post->ID, 'pyre_video', true)):
    			$html .= '<li class="video">';
    				$html .= get_post_meta($post->ID, 'pyre_video', true);
    			$html .= '</li>';
    			endif;
    			if(has_post_thumbnail()):
    			$attachment_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'recent-posts');
    			$full_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
    			$attachment_data = wp_get_attachment_metadata(get_post_thumbnail_id());
    			$html .= '[raw]<li>
    				<a href="'.$full_image[0].'" rel="prettyPhoto["gallery"]"><img src="'.$attachment_image[0].'" alt="'.''.'" /></a>
    			</li>[/raw]';
    			endif;
    			foreach($attachments as $attachment):
    			$attachment_image = wp_get_attachment_image_src($attachment->ID, 'recent-posts');
    			$full_image = wp_get_attachment_image_src($attachment->ID, 'full');
    			$attachment_data = wp_get_attachment_metadata($attachment->ID);
    			$html .= '[raw]<li>
    				<a href="'.$full_image[0].'" rel="prettyPhoto["gallery"]"><img src="'. $attachment_image[0].'" alt="'.$attachment->post_title.'" /></a>
    			</li>[/raw]';
    			endforeach;
    		$html .= '[raw]</ul>
    	</div>[/raw]';
    	endif;
    	endif;
    	if($atts['title'] == "yes"):
    	$html .= '<h3><a href="'.get_permalink($post->ID).'">'.get_the_title().'</a></h3>';
    	endif;
    	if($atts['meta'] == "yes"):
    	$html .= '<ul class="meta">';
    	$html .= '<li><em class="date">'.get_the_time('F j, Y', $post->ID).'</em></li>';
    	if(get_comments_number($post->ID) >= 1):
    	$html .= '<li>'.get_comments_number($post->ID).' Comments</li>';
    	endif;
    	$html .= '</ul>';
    	endif;
    	if($atts['excerpt'] == "yes"):
    	$html .= '<p>'.string_limit_words(get_the_excerpt(), 15).'</p>';
    	endif;
    	$html .= '</article>';
    	$count++;
    	endwhile;
    	$html .= '</div>';
    	$html .= '</section>';
    	$html .= '</div>';
    
    	return $html;
    }
    616:
    Code:
    $post->ID = get_the_ID();
    Ich hoffe Ihr könnt mir helfen..
    Zuletzt geändert von Designexe; 26.01.2013, 11:33.

  • #2
    Wo kommt $post her?

    Kommentar


    • #3
      Zitat von h3ll Beitrag anzeigen
      Wo kommt $post her?

      okay stimmt ich habe es jetz so gemaht und es funzt danke ^^..
      Code:
      [COLOR="red"]$parent = get_the_ID();[/COLOR]
      	$args = array(
      	    'post_type' => 'attachment',
      	    'numberposts' => '5',
      	    'post_status' => null,
      	   [COLOR="Red"] 'post_parent' => $parent,[/COLOR]
      		'orderby' => 'menu_order',
      		'order' => 'ASC',
      		'exclude' => get_post_thumbnail_id()

      Kommentar

      Lädt...
      X