WordPress.org

Forums

Clickable posts versus the "more" button (1 post)

  1. Thea G
    Member
    Posted 2 years ago #

    This isn't really a question, unless someone has a better way to do this.

    Since mobile devices like posts to be displayed as a nice list of clickable links versus a more button, with some experimenting I came up with a div tag that when clicked would find the anchor inside and navigate to it:
    '<div class="entry-content" style="border:1px; background-color:tan" onclick="window.location.href = this.getElementsByTagName(\'A\')[0].href " >'. $content. '</div>

    Problem with that, if the post had another anchor tag in it besides the more link it would navigate to that one. Using this same technique in a filter tag, works better and would look like this:

    global $post;
    $content = '<div class="entry-content" style="border:1px; background-color:tan" onclick="window.location.href = "'.get_permalink($post->ID).'" >'. $content. '</div> ';
    return $content;

Topic Closed

This topic has been closed to new replies.

About this Topic