Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter talikag

    (@talikag)

    Hi.

    I’m trying to put recommendations (“You might also like…”) under the posts.

    However, I do not want the recommendations to show up if you have a “Read the rest of this entry…” at the bottom of the post.

    I already managed to do this for the default theme of WordPress (by simply using REGEX to find out whether or not the content of the post contains something that looks like ‘a href=”…” class=”read more”‘ in it).

    However, I want the plugin to work in any theme, not just the default one, so I wonder if there’s a generic way to edit the content only to the posts in the page without a “Read more…” link at their bottom

    Thanks!
    Tal.

    So basically, you want to check if there are 0 posts on in a given page?
    If so, this will probably work:

    global $wp_query;
    if($wp_query->post_count == 0)
    {
       //there are no posts
    }

Viewing 2 replies - 1 through 2 (of 2 total)