Hallo ich bin neu hier und habe ein Fehler auf meiner Webseite aber iwi komme ich nicht weiter...![Confused](https://www.php-resource.de/forum/core/images/smilies/confused.gif)
Creating default object from empty value in /shortcodes.php on line 616
616:
Ich hoffe Ihr könnt mir helfen..
![Confused](https://www.php-resource.de/forum/core/images/smilies/confused.gif)
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; }
Code:
$post->ID = get_the_ID();
Kommentar