WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Remove Author | Remove Comments (23 posts)

  1. Samara
    Member
    Posted 2 years ago #

    Hi guys I'm working on this site; http://mrsdalrymple.com/ it's WordPress 3.2.1 using the Brunelleschi theme.

    I want to remove "by LONDONBOUND " author text from each post. I've looked through the trees for code etc. But I'm not understanding A) where to find the index.php and also whenever I find an index.php it doesn't have much if any code in it.

    I want to remove the ability to comment on the actual pages. Again I don't know where to find the page within the ftp and what code to add or remove.

    Thanks for any help.

  2. Harry
    Member
    Posted 2 years ago #

    You would have to navigate to the /wp-content/themes/"your theme name"/ and while each theme differs, it should be somewhere in there, not necessarily in index.php. You may need to edit loop.php, or single.php depending.

    Other than that, you could hide this by editing your style.css file.

    Below Line 963, add display: none to the .entry-meta block of CSS.

    .entry-meta {
    color: #899A21;
    font-size: 12px;
    display: none;
    }

    NOTE: This will hide anything across the website that is displayed in the entry-meta div.

  3. Samara
    Member
    Posted 2 years ago #

    Ahh I did the CSS line but it hides the date of the posting. The site author wants to be able to see the date but not the author.

  4. Harry
    Member
    Posted 2 years ago #

    Then you'll have to track down the php file in the theme containing the format for outputting the author, and remove that line. Take a backup in case you break it.

  5. Samara
    Member
    Posted 2 years ago #

    Unfortunately I do not know what piece of code to look for within the files. I've searched for "author" but I am not finding anything.

    Also still need to remove comments on the pages.

  6. Harry
    Member
    Posted 2 years ago #

    You should be looking for one of the following tags within the theme files, either in the loop.php or single.php files.

    http://codex.wordpress.org/Template_Tags#Author_tags

    Also, you should be finding this:

    <?php comments_template(); ?>

    To this:

    <?php //comments_template(); ?>
  7. Samara
    Member
    Posted 2 years ago #

    I found this in loop-attachment.php

    <header>
    						<h2 class="entry-title"><?php the_title(); ?></h2>
    
    						<div class="entry-meta">
    							<?php
    								printf( __( '<span class="%1$s">By</span> %2$s', 'brunelleschi' ),
    									'meta-prep meta-prep-author',
    									sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
    										get_author_posts_url( get_the_author_meta( 'ID' ) ),
    										sprintf( esc_attr__( 'View all posts by %s', 'brunelleschi' ), get_the_author() ),
    										get_the_author()
    									)
    								);
    							?>
    							<span class="meta-sep">|</span>
    							<?php
    								printf( __( '<span class="%1$s">Published</span> %2$s', 'brunelleschi' ),
    									'meta-prep meta-prep-entry-date',
    									sprintf( '<span class="entry-date"><abbr class="published" title="%1$s">%2$s</abbr></span>',
    										esc_attr( get_the_time() ),
    										get_the_date()
    									)
    								);
    								if ( wp_attachment_is_image() ) {
    									echo ' <span class="meta-sep">|</span> ';
    									$metadata = wp_get_attachment_metadata();
    									printf( __( 'Full size is %s pixels', 'brunelleschi' ),
    										sprintf( '<a href="%1$s" title="%2$s">%3$s &times; %4$s</a>',
    											wp_get_attachment_url(),
    											esc_attr( __( 'Link to full-size image', 'brunelleschi' ) ),
    											$metadata['width'],
    											$metadata['height']
    										)
    									);
    								}
    							?>
    							<?php edit_post_link( __( 'Edit', 'brunelleschi' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
    						</div><!-- .entry-meta -->
    					</header>

    And in the loop-single.php file I found this;

    <?php if ( get_the_author_meta( 'description' ) ) :  ?>
    					<div id="entry-author-info">
    						<div id="author-avatar">
    							<?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'brunelleschi_author_bio_avatar_size', 60 ) ); ?>
    						</div><!-- #author-avatar -->
    						<div id="author-description">
    							<h2><?php printf( esc_attr__( 'About %s', 'brunelleschi' ), get_the_author() ); ?></h2>
    							<?php the_author_meta( 'description' ); ?>
    							<div id="author-link">
    								<a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>">
    									<?php printf( __( 'View all posts by %s <span class="meta-nav">&rarr;</span>', 'brunelleschi' ), get_the_author() ); ?>
    								</a>
    							</div><!-- #author-link	-->
    						</div><!-- #author-description -->
    					</div><!-- #entry-author-info -->

    Should I be simply deleting that entire code?

  8. Harry
    Member
    Posted 2 years ago #

    loop-attachment.php refers to posts you've marked as attachment. DO NOT DELETE THIS.

    loop-single.php this block of code you've posted is NOT generating the code you wish to remove.

  9. Samara
    Member
    Posted 2 years ago #

    Hmm. I'm at a loss then. Here are the entire pages of both the loop.php and single.php

    Single.php

    [code removed - for future posting of code, please use the http://pastebin.com/ ]

  10. Harry
    Member
    Posted 2 years ago #

    Right,

    You're supposed to use pastebin for your code.

    So on actually looking at the code, as you're using a custom theme, it looks like this is where the author and date are being generated.

    <?php brunelleschi_posted_on(); ?>

    In the first block of code you should comment out the following:

    <?php comments_template( '', true ); ?>

    And:

    <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'brunelleschi' ), __( '1 Comment', 'brunelleschi' ), __( '% Comments', 'brunelleschi' ) ); ?></span>

    AS ALWAYS, take a BACKUP in case anything should go awry.

  11. Samara
    Member
    Posted 2 years ago #

    By removing the <?php brunelleschi_posted_on(); ?> it also removed the date the entry was posted which I would still need to keep in there.

    The second two codes are to remove the comments I assume? In terms of the comments I found a widget which simply disabled it for my pages.

  12. Harry
    Member
    Posted 2 years ago #

    If you read carefully, I said it was where it was generated, not to remove it, you need to find and edit that function.

  13. Samara
    Member
    Posted 2 years ago #

    Ah I suppose I didn't understand what you meant by edit. What exactly am I supposed to change the code to? I do not know php so I'm not sure how I am supposed to modify the function.

  14. Harry
    Member
    Posted 2 years ago #

    could you copy the code from your functions.php to http://pastebin.com, it would most likely be in there.

  15. Samara
    Member
    Posted 2 years ago #

    http://pastebin.com/rVvFQtD2

    There you go, the functions.php I appreciate all the help you've been giving me. :)

  16. Harry
    Member
    Posted 2 years ago #

    No worries about the help. I understand when you're trying to do something it's quite tough when you need to get up to speed, and it's almost impossible to pick up PHP and WordPress straight away.

    So, on line 110:

    printf( __('<span class="meta-sep">by</span> %3$s <span class="%1$s">Posted on</span> %2$s', 'brunelleschi' ),

    I think this is the part of that line you will want to remove. Take a back up beforehand in case I'm wrong.

    <span class="meta-sep">by</span> %3$s

    Hope this is it!

  17. Samara
    Member
    Posted 2 years ago #

    Awesome! That's exactly what I needed. Thank you so much for your patience. :)

  18. Harry
    Member
    Posted 2 years ago #

    Cool, we got there in the end.

  19. Samara
    Member
    Posted 2 years ago #

    Last question while this thread isn't locked! 0:)

    How would I position the date above the title entry?

  20. laptophobo
    Member
    Posted 2 years ago #

    Can I remove the author from only the static pages and custom pages?

  21. laptophobo
    Member
    Posted 2 years ago #

    Using harmck's example above, I styled my style sheet like so:

    body.single .entry-meta {
    	display: none;
    }

    In doing so, this changes the author/date/category info links only on specific areas of the site.

  22. Harry
    Member
    Posted 2 years ago #

    You've specified body.single which is most likely why it is only disappearing in some places. Do you have a link by any chance?

  23. IslandOwl
    Member
    Posted 2 years ago #

    Harry, if you are seeing this chain still, I tried to edit the line you suggested, by removing that one part and it crashed the site - no big deal because I am using a dummy domain and site to test this on.

    But how should I have changed that code? It also does not show up as line 110. It is lines 332 - 347 at least how I am looking at it. The code is at: http://pastebin.com/8qhWKhZW

Topic Closed

This topic has been closed to new replies.

About this Topic