0

I'm doing a plugin that generates custom subpages (i.e. it's an app that has nothing to do with WPs posts). I did the rewrite thing (rewrite + query_vars + template_redirect), I generate the content and it generally works. I use

add_filter('the_content', array($this, 'drawLatest'));

drawLatest does this:

public function drawLatest () {
    $content = "";
    ...
    $content .= ...;

    return $content;
}

It works - the page is populated with the content I'd like it to have.

However, on the top - above my content - there is still displayed title + date of latest post.

In the HTML, I see it like this:

<div id="content" class="clearfix">
    <div id="column-content" class="column column-content posts">
    <div id="post-81" class="clearfix post-81 post type-post status-publish format-standard hentry category-something">
    <h2><a href="..." rel="bookmark">TITLE OF LATEST POST</a></h2>
    <p class="entry-meta">
    <a href="..." title="..." rel="bookmark">date</a> <span class="sep">/ </span> <a href="...">Leave a comment</a><span class="edit-link"><span class="sep"> / </span><a class="post-edit-link" href="...">Edit</a></span> </p><!-- end .entry-meta -->

    <div class="entry-summary">HERE IS MY CONTENT

I would like to get rid of this latest post title, too - how can I do it?

  • The title and date aren’t part of the content. You’ll need to remove them from the template directly or hide them with CSS. – Jacob Peattie Aug 28 '18 at 13:34
  • I see..would you suggest any other way of creating custom page (I did with template_redirect) so I'd get just a blank page without "latest post" (i.e. it wouldn't draw any content beside what the plugin draws)? – May11 Aug 29 '18 at 6:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.