Notification WP_Error:$slug on tag- and archive-pages
-
Hello,
I always get this notification at the end of the page, when i click on one of the tags or one of the months in the archives:
Notice: Undefined property: WP_Error::$slug in /opt/wordpress/wp-includes/class-wp-error.php on line 78
when i look into class-wp-error.php on line 77-79, there’s this code:
public function __get( $name ) { return $this->$name; }
I don’t have any idea what to do. Can someone maybe help?
Thanks!
-
Hi,
Let’s see if we can troubleshoot this for you, could you try deactivating any plugins you have and seeing if the problem persists?
If it doesn’t, try enabling them one by one to see which one caused the problem.
If it does still persist, could you share your site with us or the code used to display the tags on your site?
Hey,
thanks for the response. i deactivated every plugin separately but nothing happened (except for the “WP No Category Base” Plugin, there the page didn’t even show anymore, only a heading with: Not Found).
Heres the site: blog.mila.com (if you click on the right on one of the tags, or on the archive, the error shows up at the end of the page)Hi,
It seems your theme is trying to add a button there called “Load More”, but the code for it isn’t quite right.
I see it’s a custom theme, do you happen to know the code for the load more section? If you’re unfamiliar with the code it might help to ask the person that developed the site about that, they might even know what’s wrong and have a solution at hand.
Hey ??
Yes i have the code, but it was an extern developer and she isn’t working here anymore, so i can’t ask her.. but i found the code for the archives page, and there are three places in which “Load more (in german: Mehr laden)” is used.
here is the archives.php code:<?php get_header(); ?> <div id="contentWrap"> <div > <?php if ( have_posts() ) : ?> <?php if (is_category()) { ?> <h2 id="archiveTitle">Archive for the ‘<?php single_cat_title(); ?>’ Category</h2> <?php } elseif( is_tag() ) { ?> <h2 id="archiveTitle">Posts Tagged ‘<?php single_tag_title(); ?>’</h2> <?php } elseif (is_day()) { ?> <h2 id="archiveTitle">Archive for <?php the_time('F jS, Y'); ?></h2> <?php } elseif (is_month()) { ?> <h2 id="archiveTitle">Archive for <?php the_time('F, Y'); ?></h2> <?php } elseif (is_year()) { ?> <h2 id="archiveTitle">Archive for <?php the_time('Y'); ?></h2> <?php } elseif (is_author()) { ?> <h2 id="archiveTitle">Author Archive</h2> <?php } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?> <h2 id="archiveTitle">Archives</h2> <?php } ?> <div class="container-fluid category"> <div class="row"> <?php $count = 1 ?> <?php while ( have_posts() ) : the_post(); ?> <?php if($count % 2 != 0) : ?> <div class="col-xs-12 col-sm-12 col-md-6 left" style="height:600px;"> <section> <h4 class="title"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h4> <div class="post_data"> <span class="glyphicon glyphicon-calendar details" style="margin-left: 0px;"></span><?php the_time('j F Y') ?> <span class="glyphicon glyphicon-tag details"></span><?php the_tags('', ', ', ' '); ?> <span class="glyphicon glyphicon-comment details"></span><?php comments_popup_link('0', '1', '%'); ?> </div> <article> <p> <?php //echo substr(get_the_excerpt(), 0,30); echo get_excerpt(130); //echo string_limit_words($excerpt,30); if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it. the_post_thumbnail(array(430, 250)); } ?> </p> </article> </section> </div> <?php endif; ?> <?php if($count % 2 == 0) : ?> <div class="col-xs-12 col-sm-12 col-md-6 right" style="height:600px;"> <section> <h4 class="title"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h4> <div class="post_data"> <span class="glyphicon glyphicon-calendar details" style="margin-left: 0px;"></span><?php the_time('j F Y') ?> <span class="glyphicon glyphicon-tag details"></span><?php the_tags('', ', ', ' '); ?> <span class="glyphicon glyphicon-comment details"></span><?php comments_popup_link('0', '1', '%'); ?> </div> <article> <p> <?php echo get_excerpt(130); if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it. the_post_thumbnail(array(430, 250)); } ?> </p> </article> </section> </div> <?php endif; ?> <?php $count++; ?> <?php endwhile; ?> <?php if($count % 2 == 0) : ?><!--Adding a empty element to move Load More to next line --> <div class="col-xs-12 col-sm-12 col-md-6 right" style="height:600px;"> </div> <?php endif; ?> <?php $cat = get_category( get_query_var( 'cat' ) ); $category = $cat->slug; ?> <div id="content" class="col-xs-12 col-sm-12" style="float:left;"> <?php //echo do_shortcode('[ajax_load_more category="'.$category.'" post_type="post" offset="6" posts_per_page="6" scroll="false" pause="true" button_label="Mehr laden"]'); ?> </div> <?php else : ?> <h2>Not Found</h2> <?php endif; ?> <?php $max = $wp_query->max_num_pages; ?> <script type='text/javascript'> /* <![CDATA[ */ var pbd_alp = {"startPage":"1","maxPages":"<?php echo $max; ?>","nextLink":"https://blog.mila.com/archive/"}; /* ]]> */ </script> <script type="text/javascript"> $(document).ready(function() { // The number of the next page to load (/page/x/). var pageNum = parseInt(pbd_alp.startPage) + 1; // The maximum number of pages the current query can return. var max = parseInt(pbd_alp.maxPages); // The link of the next page of posts. var nextLink = pbd_alp.nextLink; /** * Replace the traditional navigation with our own, * but only if there is at least one page of new posts to load. */ if(pageNum <= max) { // Insert the "More Posts" link. $('#content') .append('<div class="pbd-alp-placeholder-'+ pageNum +'"></div>') .append('<p id="pbd-alp-load-posts"><a href="#">Mehr Laden</a></p>'); // Remove the traditional navigation. $('.navigation').remove(); } /** * Load new posts when the link is clicked. */ $('#pbd-alp-load-posts a').click(function() { // Are there more posts to load? if(pageNum <= max) { // Show that we're working. $(this).text('Wird geladen...'); $.ajax({ type: "POST", url: nextLink, data: "paged="+pageNum+"&tag=<?php echo get_query_var('tag'); ?>", dataType: "html", success: function(d){ $('.pbd-alp-placeholder-'+ pageNum).html(d); // Update page number and nextLink. pageNum++; //nextLink = nextLink.replace(/\/page\/[0-9]?/, '/page/'+ pageNum); // Add a new placeholder, for when user clicks again. $('#pbd-alp-load-posts') .before('<div class="pbd-alp-placeholder-'+ pageNum +'"></div>') // Update the button message. if(pageNum <= max) { $('#pbd-alp-load-posts a').text('Mehr Laden'); } else { $('#pbd-alp-load-posts a').text('No more posts to load.'); } } }); } else { $('#pbd-alp-load-posts a').append('.'); } return false; }); }); </script> <div class="col-xs-12" style="padding-left: 0px;padding-right: 0px"> <hr > </div> <div class="col-xs-12"> <div class="sidebar_popular_posts"> <?php $args=array( 'showposts'=>3, 'ignore_sticky_posts'=>1 ); $i = 1; $my_query = new WP_Query($args); if( $my_query->have_posts() ) { while ($my_query->have_posts()) : $my_query->the_post(); ?> <div class="col-xs-12 col-sm-4"> <div class="sidebar_popular_posts"> <?php if($i == 1) { ?> <div class="sidebar_head"><a href="#">Popular Posts</a></div> <?php } else { ?> <div class="sidebar_head" style="@media(max-width:768px){margin-bottom:55px;}"><a href="#"></a></div> <?php } $i = 2; ?> <div class="post_link"> <span class="glyphicon glyphicon-calendar details"></span><span class="post_data"><?php the_time('j F Y'); ?></span> <h5><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h5> </div> </div> </div> <?php endwhile; } ?> </div> </div> </div> <!-- end row --> </div> <!-- end cont-fluid --> </div> <!-- end contentWrap --> </div> <!-- end content --> <?php get_footer(); ?>
Maybe you can find something..
- The topic ‘Notification WP_Error:$slug on tag- and archive-pages’ is closed to new replies.