Hello tactics,
Can you post a link to a page where this is happening.
Note: should be “nbsp” between the quotes above
Yep. Scroll down to the bottom of the page. The first post has one, the second has four, the last one has none. Completely random…
http://violetweddings.com/wedding-styles/classic-fifth-avenue/
So these are images and text you’ve put in the excerpt field when editing or publishing a post? Or do you add the images some other way?
I’m not manually creating an excerpt. These are the excerpts that wordpress automatically generates from the first few words in the post.
<?php if ( $related_posts ) : ?>
<ul>
<?php foreach ( $related_posts as $post ) :
setup_postdata( $post ); ?>
<li>
<?php the_post_thumbnail('thumbnail'); ?>
<h4>
<?php if ( get_the_title() ) the_title(); else the_ID(); ?>
</h4>
<?php the_excerpt(); ?>
<a href="<?php the_permalink() ?>">Read More</a> </li>
<?php endforeach; ?>
</ul>
<?php else : ?>
<p>
<?php _e( 'No related posts found', 'related-posts-by-taxonomy' ); ?>
</p>
<?php endif ?>
<?php
Are you adding the widget in the wp-admin/customizer or with code in your theme template files? I’m asking because there’s something strange going on with the markup of the widget. It’s all wrapped in a list item.
<aside class="related-posts">
<li id="related-posts-by-taxonomy-2" class="widget related_posts_by_taxonomy">
<h3>Related Blog Posts</h3>
<ul>
<li>...</li>
<li>...</li>
<li>...</li>
</ul>
</li>
</aside>
This could be your theme’s doing, but there is no outer <ul>
tag.
I’m adding it using the widget. In my template:
<aside class="related-posts">
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("Aside Widget") ) : ?>
<?php endif; ?>
</aside>
in my functions.php:
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name' => 'Aside Widget',
'before_title' => '<h3>',
'after_title' => '</h3>',
)
);
Can you change this:
<aside class="related-posts">
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("Aside Widget") ) : ?>
<?php endif; ?>
</aside>
to
<?php if ( is_active_sidebar( 'Aside Widget' ) ) : ?>
<aside class="related-posts">
<ul>
<?php dynamic_sidebar( 'Aside Widget' ); ?>
</ul>
</aside>
<?php endif; ?>
When I do that, the widget doesn’t show up at all.
Check if the widget is in the Aside Widget sidebar at wp-admin > Appearance > Widgets.
It is. And as you can see, now nothing shows up on the page.
Does it show up if you use just this (for testing):
<aside class="related-posts">
<ul>
<?php dynamic_sidebar( 'Aside Widget' ); ?>
</ul>
</aside>
Yes, but it still has the white space.