Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi tommyfoxy2. How about the Published date? Are you still wanting to display that?

    Abdul Samad

    (@abdul-samad-k-t)

    You can add this styles to hide author
    span.by-author {
    display: none;
    }

    Thread Starter Tommyfoxy2

    (@tommyfoxy2)

    You can add this styles to hide author
    span.by-author {
    display: none;
    }

    That hides the author and the date which is not what I want to do

    @bdbrown yes id prefer to keep the published date

    • This reply was modified 8 years, 2 months ago by Tommyfoxy2.

    1. If you don’t already have a child theme install one using these instructions:
    https://docs.presscustomizr.com/article/239-using-a-child-theme-with-hueman

    2. Using your host file manager or FTP, create a subfolder /parts in your child theme.

    3. Copy the parent theme template file /parts/single-author-date.php to the /parts subfolder in your child theme.

    4. In the single-author-date.php file change the main default content which is this:

    <p class="post-byline"><?php _e('by','hueman'); ?>
       <span class="vcard author">
         <span class="fn"><?php the_author_posts_link(); ?></span>
       </span> &middot;
        <?php if ( hu_is_checked('structured-data') ) : ?>
              <?php if( get_the_modified_date() != get_the_date() || get_the_modified_time() != get_the_time() ) : ?>
                  <?php _e('Published', 'hueman'); ?> <time class="published" datetime="<?php echo $published_date; ?>"><?php echo $published_date; ?></time>
                  &middot; <?php _e('Updated', 'hueman'); ?> <time class="updated" datetime="<?php the_modified_date( get_option('date_format') ); ?>"><?php the_modified_date( get_option('date_format') ); ?></time>
              <?php else : ?>
                  <time class="published" datetime="<?php echo $published_date; ?>"><?php echo $published_date; ?></time>
              <?php endif; ?>
        <?php else : ?>
            <span class="published"><?php echo $published_date; ?></span>
        <?php endif ?>
     </p>

    to this:

    <p class="post-byline">
        <!-- remove post author link and modified date -->
        <?php if ( hu_is_checked('structured-data') ) : ?>
              <?php if( get_the_modified_date() != get_the_date() || get_the_modified_time() != get_the_time() ) : ?>
                  <?php _e('Published', 'hueman'); ?> <time class="published" datetime="<?php echo $published_date; ?>"><?php echo $published_date; ?></time>
              <?php else : ?>
                  <time class="published" datetime="<?php echo $published_date; ?>"><?php echo $published_date; ?></time>
              <?php endif; ?>
        <?php else : ?>
            <span class="published"><?php echo $published_date; ?></span>
        <?php endif ?>
     </p>
    • This reply was modified 8 years, 2 months ago by bdbrown.
    Thread Starter Tommyfoxy2

    (@tommyfoxy2)

    Doesn’t work, just breaks the site and makes all my posts white

    Well, that’s not good. I just ran the same modification on a test site and didn’t have any problems. Can you copy the entire contents of your child theme single-author-date.php file here (make sure to enclose the code block using the “code” button). Thanks.

    Thread Starter Tommyfoxy2

    (@tommyfoxy2)

    <?php
    /*  Print the post author. Compatible with Google Structured data. Must be used in the WordPress loop
    * @php return html string
    /* ------------------------------------ */
    $published_date = get_the_date( get_option('date_format') );
    ?>
    <p class="post-byline"><?php _e('by','hueman'); ?>
       <span class="vcard author">
         <span class="fn"><?php the_author_posts_link(); ?></span>
       </span> &middot;
        <?php if ( hu_is_checked('structured-data') ) : ?>
              <?php if( get_the_modified_date() != get_the_date() || get_the_modified_time() != get_the_time() ) : ?>
                  <?php _e('Published', 'hueman'); ?> <time class="published" datetime="<?php echo $published_date; ?>"><?php echo $published_date; ?></time>
                  &middot; <?php _e('Updated', 'hueman'); ?> <time class="updated" datetime="<?php the_modified_date( get_option('date_format') ); ?>"><?php the_modified_date( get_option('date_format') ); ?></time>
              <?php else : ?>
                  <time class="published" datetime="<?php echo $published_date; ?>"><?php echo $published_date; ?></time>
              <?php endif; ?>
        <?php else : ?>
            <span class="published"><?php echo $published_date; ?></span>
        <?php endif ?>
     </p>

    Is that the single-author-date.php file from your child theme? It doesn’t appear that it’s been modified with the code I posted above. In any case, I ran the code you posted and it doesn’t generate any errors.

    • This reply was modified 8 years, 2 months ago by bdbrown.
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Hide “By” and “Updated” from single post’ is closed to new replies.