• Resolved Akasashasha

    (@akasashasha)


    Hello,

    I’d like my posts on home page not to display the entry meta (date, categorie, etc ..)
    if that could be added to this piece of code that would be great, that way I’ll have all the changes concerning the home page in few lines :

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. Not the blockquoute. ]

    function my_post_queries( $query ) {
      // only homepage and is the main query
      if ($query->is_home() && $query->is_main_query()){
         // display only posts in category with id=15 on home page
         $query->set('cat', 15);
         // sticky posts in slider but not on home page
         $query->set('post__not_in', get_option( 'sticky_posts' ) );
      }
    }
    add_action( 'pre_get_posts', 'my_post_queries' );

    fanx a lot!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The easier way to do what you want may be to use “display: none;” in the CSS — using the page ID to isolate it to that page only.

    Thread Starter Akasashasha

    (@akasashasha)

    sorry but I’m not learned enough to do this … given that the posts on my home page are part of the post category n°14, how would you code this ?
    I’m only able to change the following in my style.css
    . entry-meta {display:none;}

    but I don’t know how to specify which category not to display this meta infos … some more help please ?
    thank you

    edit : I found the string in the single.php file,

    <header class=”entry-header”>
    <<?php esplanade_title_tag( ‘post’ ); ?> class=”entry-title”><?php the_title(); ?></<?php esplanade_title_tag( ‘post’ ); ?>>
    <aside class=”entry-meta”>
    <?php the_time( get_option( ‘date_format’ ) ); ?> |
    <?php _e( ‘Filed under’, ‘esplanade’ ); ?>: <?php the_category( ‘, ‘ ) ?>
    <?php the_tags( __( ‘and tagged with: ‘, ‘esplanade’ ), ‘, ‘, ” ); ?>
    <?php edit_post_link( __( ‘Edit’, ‘esplanade’ ), ‘ | ‘, ” ); ?>
    </aside><!– .entry-meta –>
    </header><!– .entry-header –>

    can you tell me what should I change here ?

    You don’t likely need to change php, but posting a link to the site would be helpful.

    Thread Starter Akasashasha

    (@akasashasha)

    not possible, I’m developing on local … however, you can have a look at the theme I’m using here … so, as a reminder, I’d like to exclude some category from showing the entry meta …

    thank you

    Not totally sure if this is what you want to do and not totally sure this will work with your site, but this will hide the meta on the home page — no matter what the category is:

    .home .entry-meta {
         display: none;
    }

    Thread Starter Akasashasha

    (@akasashasha)

    that’s ok, thanks a lot !

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘do not display the entry meta on home page’ is closed to new replies.