Welcome to PressWork!

Want to ask a question or join the discussion? Great! Join now.

In this Discussion

Removing author/date/comment count from all posts
  • I seem to remember this option when I installed PressWork but can't locate the setting to hide this info from the homepage and the post page.

  • You need to write some custom actions to do that. Read this:

    http://presswork.me/2011/custom-css-and-custom-actions/

    Once you understand how to create a custom-action.php file, you can add this to remove the meta:
    <?php
    /*
    * Featured posts
    */

    function new_pw_posts_featured() {
    echo pw_function_handle(__FUNCTION__);
    global $pw;
    $rightcon = '';
    if(function_exists('has_post_thumbnail') && has_post_thumbnail() && (function_exists('has_post_format') && !has_post_format('gallery') && !has_post_format('video'))) {
    echo '<a href="'.get_permalink().'">';
    if($pw==1) { $thumb = 'sticky'; $class = 'alignnone'; } else { $thumb = 'thumbnail'; $class = 'alignleft'; }
    the_post_thumbnail($thumb, array('class'=>$class));
    echo '</a>';
    $rightcon = ' class="content-col"';
    }
    ?>
    <div<?php echo $rightcon; ?>>
    <header>
    <h1 class="posttitle"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', "presswork" ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
    </header>
    <div class="storycontent">
    <?php
    if(function_exists('has_post_format') &&
    (has_post_format('aside') || has_post_format('link') || has_post_format('video') || has_post_format('image') || has_post_format('audio'))) {
    // new aside || link || audio || video || image post format
    echo '<div class="pformat clear">';
    the_content('');
    echo '</div>';
    } elseif(function_exists('has_post_format') && has_post_format('gallery')) { // new gallery post format
    global $post;
    $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
    if ( $images ) :
    $total_images = count( $images );
    $image = array_shift( $images );
    $image_img_tag = wp_get_attachment_image( $image->ID, 'full' );
    ?>
    <a class="gallery-thumb" href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
    <p class="gallery-text clear fl"><em><?php printf( _n( 'This gallery contains <a %1$s>%2$s photo &rarr;</a>', 'This gallery contains <a %1$s>%2$s photos &rarr;</a>', $total_images, "presswork" ),
    'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', "presswork" ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"',
    number_format_i18n( $total_images )
    ); ?></em>
    </p>
    <?php endif; ?>
    <?php
    } else {
    the_excerpt();
    echo '<a href="'.get_permalink().'" class="more-link">'.__("Read more &rarr;", "presswork").'</a>';
    ?>
    <?php } ?>
    </div>
    </div>
    <?php
    }
    remove_action('pw_index_sticky_post_middle', 'pw_posts_featured');
    remove_action('pw_index_featured_post_middle', 'pw_posts_featured');
    add_action('pw_index_sticky_post_middle', 'new_pw_posts_featured');
    add_action('pw_index_featured_post_middle', 'new_pw_posts_featured');
     
    /*
    * Posts
    */

    function new_pw_posts() {
    echo pw_function_handle(__FUNCTION__);
    ?>
    <header>
    <h1 class="posttitle"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', "presswork" ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
    </header>
    <div class="storycontent">
    <?php
    if(function_exists('has_post_format') &&
    (has_post_format('aside') || has_post_format('link') || has_post_format('video') || has_post_format('image') || has_post_format('audio'))) {
    // new aside || link || audio || video || image post format
    echo '<div class="pformat clear">';
    if(function_exists('has_post_format') && has_post_format('image')) {
    if(function_exists('has_post_thumbnail') && has_post_thumbnail()) {
    echo '<a href="'.get_permalink().'">';
    the_post_thumbnail('medium', array('class'=>'alignleft'));
    echo '</a>';
    } else {
    the_content('');
    }
    } else {
    the_content('');
    }
    echo '</div>';
    } elseif(function_exists('has_post_format') && has_post_format('gallery')) { // new gallery post format
    global $post;
    $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
    if ( $images ) :
    $total_images = count( $images );
    $image = array_shift( $images );
    $image_img_tag = wp_get_attachment_image( $image->ID, 'full' );
    ?>
    <a class="gallery-thumb" href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
    <p class="gallery-text clear fl"><em><?php printf( _n( 'This gallery contains <a %1$s>%2$s photo &rarr;</a>', 'This gallery contains <a %1$s>%2$s photos &rarr;</a>', $total_images, "presswork" ),
    'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', "presswork" ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"',
    number_format_i18n( $total_images )
    ); ?></em>
    </p>
    <?php endif; ?>
    <?php
    } else {
    if(function_exists('has_post_thumbnail') && has_post_thumbnail()) {
    echo '<a href="'.get_permalink().'">';
    if(is_home()) $thumb = 'fifty'; else $thumb = 'thumbnail';
    the_post_thumbnail($thumb, array('class'=>'alignleft'));
    echo '</a>';
    }
    the_excerpt();
    }
    if(function_exists('has_post_format') && (has_post_format('aside') || has_post_format('link') || has_post_format('gallery'))) { // new aside || link post format
    // do nothing
    } else {
    echo '<a href="'.get_permalink().'" class="more-link">'.__("Read more &rarr;", "presswork").'</a>';
    }
    ?>
    </div>
    <?php
    }
    remove_action('pw_archive_post_middle', 'pw_posts');
    remove_action('pw_author_post_middle', 'pw_posts');
    remove_action('pw_category_post_middle', 'pw_posts');
    remove_action('pw_search_post_middle', 'pw_posts');
    remove_action('pw_index_post_middle', 'pw_posts');
    add_action('pw_archive_post_middle', 'new_pw_posts');
    add_action('pw_author_post_middle', 'new_pw_posts');
    add_action('pw_category_post_middle', 'new_pw_posts');
    add_action('pw_search_post_middle', 'new_pw_posts');
    add_action('pw_index_post_middle', 'new_pw_posts');
    image Senior Developer & Co-Founder of PressWork
  • I did that and it removed the author's name from the post heading; however, the author's name still appears at the end of each post.
  • works on index page but not on single post for me :(
  • Remove the authorbox: http://presswork.me/2011/remove-the-authorbox-from-single-posts/

    For single posts, you need to modify this code:
    function pw_single_post() {
    echo pw_function_handle(__FUNCTION__);
    ?>
    <header>
    <?php if(is_single()) echo '<hgroup>'; ?>
    <h1 class="posttitle"><?php the_title(); ?></h1>
    <?php if(is_single()) { ?>
    <h2 class="meta">
    <?php
    _e("by", "presswork"); echo " "; the_author_posts_link();
    echo '&nbsp;&bull;&nbsp;';
    the_time(get_option('date_format'));
    echo '&nbsp;&bull;&nbsp;';
    the_category(', ');
    if(comments_open()) { echo '&nbsp;&bull;&nbsp;'; comments_popup_link(__('0 Comments', "presswork"),__('1 Comment', "presswork"),__('% Comments', "presswork")); }
    ?>
    </h2>
    <?php } ?>
    <?php if(is_single()) echo '</hgroup>'; ?>
    </header>
    <div class="storycontent">
    <?php the_content( __( 'Read more &rarr;', "presswork" ) ); ?>
    </div>
    <footer>
    <?php
    the_tags('<p class="tags"><small>'.__('Tags', "presswork").': ', ', ', '</small></p>');
    wp_link_pages(array('before' => '<p><strong>'.__('Pages', "presswork").':</strong> ', 'after' => '</p>', 'next_or_number' => 'number'));
    edit_post_link(__('(edit)', "presswork"), '<p class="clear">', '</p>');
    ?>
    </footer>
    <?php
    }
    add_action('pw_single_post_middle', 'pw_single_post');
    add_action('pw_page_post_middle', 'pw_single_post');

    image Senior Developer & Co-Founder of PressWork
  • Ok. Now I tried the all 3 pieces of code to get rid of reply-field and coment count and so on... I made a custom-actions.php file. For a while it worked, but now I did something so the whole thing dissapeared:( Help?!? www.designes.es
    Btw, I tried removing custom-actions.php file from my uploads and that doesnt help. Shouldn´t it all go back to normal when I removed thart one?:(
    Edit:
    Ok. I got it back, puuh:) But I still wonder how to get rid of the whole reply field from both pages and posts?
    PS. Thanks for a very good theme! Good work!!!
    Skjermbilde 2011-10-04 kl. 14.35.59.png
    713 x 764 - 254K
    Post edited by samacom at 2011-10-04 08:37:26
  • You can turn off the reply field (aka comments) on the post/page edit screen in the wp-admin. If you don't see the Discussion panel, open up the Screen Options (top right) and turn it on. Then you can turn off the comments completely for that specific post/page.
    image Senior Developer & Co-Founder of PressWork
  • Hi, what would be the case if I want to hide the above meta only for a specific custom post type and not for my blog posts. I am building a e-shop with the wp e-commerce plugin and I want to hide the meta in the single product page.
  • @cmavrikas
    You would need to modify the
    pw_single_post()
    function as stated above by @cbavota and introduce the
    is_singular( 'your_custom_post_type' )
    conditional tag to get rid of the meta part.
    Post edited by cestbibi at 2011-10-06 07:51:00
    image PressWork Support Moderator
  • Hi, I am quite new to modifying custom-actions and php.
    I could manage turn of Author. And the code @cbavota posted on 9 Sep it worked, although only at index page.
    @cbavota kindly added extra code for single page on 12 Sep. Though I can't combine this single post and previous index page one.
    Is anyone kind enough to post combined code? I would like to disable Author and Comments.


    Also I couldn't find this option from wp-admin.
    cbavota said:

    You can turn off the reply field (aka comments) on the post/page edit screen in the wp-admin. If you don't see the Discussion panel, open up the Screen Options (top right) and turn it on. Then you can turn off the comments completely for that specific post/page.




  • ayo said:


    Also I couldn't find this option from wp-admin.


    When editing a Post or Page make sure this is checked / unchecked


    imageimage
    Edit Post < DEV Site — WordPress(2).jpg
    400 x 112 - 19K
    Edit Post < DEV Site — WordPress(1).jpg
    400 x 429 - 34K
    image PressWork Support Moderator
  • @cestbibi Thank you so much to make such a kind images for beginners like me. It helps me a lot.

    I am sorry to be greedy to ask again, but is there any way to invisible comments automatically instead of everytime when you post check the discussion panel off?

    I would like to turn off Author (both indexpage and single post invisible) and comment. Simply combine @cbavota wrote 9, 12 Sep into custom action didn't work for me somehow.
  • ayo said:

    but is there any way to invisible comments automatically instead of everytime when you post check the discussion panel off?


    Yes you can achieve this by going to your Wordpress Dashboard --> Settings --> Discussion --> and on top of Discussion Settings page uncheck "Allow people to post comments on new articles "

    ayo said:

    I would like to turn off Author (both indexpage and single post invisible) and comment.



    Use @cbavota code on 9 as it is
    As for the other code(12) it has to be modified.
    You can use this
    function new_single_post() {
    echo pw_function_handle(__FUNCTION__);
    ?>
    <header>
    <?php if(is_single()) echo '<hgroup>'; ?>
    <h1 class="posttitle"><?php the_title(); ?></h1>
    <?php if(is_single()) echo '</hgroup>'; ?>
    </header>
    <div class="storycontent">
    <?php the_content( __( 'Read more &rarr;', "presswork" ) ); ?>
    </div>
    <footer>
    <?php
    the_tags('<p class="tags"><small>'.__('Tags', "presswork").': ', ', ', '</small></p>');
    wp_link_pages(array('before' => '<p><strong>'.__('Pages', "presswork").':</strong> ', 'after' => '</p>', 'next_or_number' => 'number'));
    edit_post_link(__('(edit)', "presswork"), '<p class="clear">', '</p>');
    ?>
    </footer>
    <?php
    }
    remove_action('pw_single_post_middle', 'pw_single_post');
    remove_action('pw_page_post_middle', 'pw_single_post');
    add_action('pw_single_post_middle', 'new_single_post');
    add_action('pw_page_post_middle', 'new_single_post');


    Compare the code I just posted with that of (12) to understand what we have done here and how Presswork works. Also reading this is a good start http://presswork.me/2011/custom-css-and-custom-actions/

    Post edited by cestbibi at 2011-10-26 04:15:00
    image PressWork Support Moderator
  • @cestbibi Thanks a lot. Author/date/comment/category are totally cleaned out!

    Last question. How can I leave only "date" on? Where is "date" in this code? I tried few combinations delete and back to try which is working, but couldn't find it.

    I've read custom-actions page several times so far, will look into general php to understand this more.
  • You have to maintain this part to keep the time only
    <h2 class="meta">
    <?php
    the_time(get_option('date_format'));
    ?>
    </h2>


    So for the code I gave you it would be this:
    function new_single_post() {
    echo pw_function_handle(__FUNCTION__);
    ?>
    <header>
    <?php if(is_single()) echo '<hgroup>'; ?>
    <h1 class="posttitle"><?php the_title(); ?></h1>
    <?php if(is_single()) { ?>
    <h2 class="meta">
    <?php
    the_time(get_option('date_format')); //we keep the time only
    ?>
    </h2>
    <?php } ?>
    <?php if(is_single()) echo '</hgroup>'; ?>
    </header>
    <div class="storycontent">
    <?php the_content( __( 'Read more &rarr;', "presswork" ) ); ?>
    </div>
    <footer>
    <?php
    the_tags('<p class="tags"><small>'.__('Tags', "presswork").': ', ', ', '</small></p>');
    wp_link_pages(array('before' => '<p><strong>'.__('Pages', "presswork").':</strong> ', 'after' => '</p>', 'next_or_number' => 'number'));
    edit_post_link(__('(edit)', "presswork"), '<p class="clear">', '</p>');
    ?>
    </footer>
    <?php
    }
    remove_action('pw_single_post_middle', 'pw_single_post');
    remove_action('pw_page_post_middle', 'pw_single_post');
    add_action('pw_single_post_middle', 'new_single_post');
    add_action('pw_page_post_middle', 'new_single_post');


    And for the code in (9) it would be like this:
    /*
    * Featured posts
    */
    function new_pw_posts_featured() {
    echo pw_function_handle(__FUNCTION__);
    global $pw;
    $rightcon = '';
    if(function_exists('has_post_thumbnail') && has_post_thumbnail() && (function_exists('has_post_format') && !has_post_format('gallery') && !has_post_format('video'))) {
    echo '<a href="'.get_permalink().'">';
    if($pw==1) { $thumb = 'sticky'; $class = 'alignnone'; } else { $thumb = 'thumbnail'; $class = 'alignleft'; }
    the_post_thumbnail($thumb, array('class'=>$class));
    echo '</a>';
    $rightcon = ' class="content-col"';
    }
    ?>
    <div<?php echo $rightcon; ?>>
    <header>
    <h1 class="posttitle"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', "presswork" ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
    <h2 class="meta">
    <?php
    the_time(get_option('date_format')); //we keep the time only
    ?>
    </h2>
    </header>
    <div class="storycontent">
    <?php
    if(function_exists('has_post_format') &&
    (has_post_format('aside') || has_post_format('link') || has_post_format('video') || has_post_format('image') || has_post_format('audio'))) {
    // new aside || link || audio || video || image post format
    echo '<div class="pformat clear">';
    the_content('');
    echo '</div>';
    } elseif(function_exists('has_post_format') && has_post_format('gallery')) { // new gallery post format
    global $post;
    $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
    if ( $images ) :
    $total_images = count( $images );
    $image = array_shift( $images );
    $image_img_tag = wp_get_attachment_image( $image->ID, 'full' );
    ?>
    <a class="gallery-thumb" href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
    <p class="gallery-text clear fl"><em><?php printf( _n( 'This gallery contains <a %1$s>%2$s photo &rarr;</a>', 'This gallery contains <a %1$s>%2$s photos &rarr;</a>', $total_images, "presswork" ),
    'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', "presswork" ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"',
    number_format_i18n( $total_images )
    ); ?></em>
    </p>
    <?php endif; ?>
    <?php
    } else {
    the_excerpt();
    echo '<a href="'.get_permalink().'" class="more-link">'.__("Read more &rarr;", "presswork").'</a>';
    ?>
    <?php } ?>
    </div>
    </div>
    <?php
    }
    remove_action('pw_index_sticky_post_middle', 'pw_posts_featured');
    remove_action('pw_index_featured_post_middle', 'pw_posts_featured');
    add_action('pw_index_sticky_post_middle', 'new_pw_posts_featured');
    add_action('pw_index_featured_post_middle', 'new_pw_posts_featured');
     
    /*
    * Posts
    */

    function new_pw_posts() {
    echo pw_function_handle(__FUNCTION__);
    ?>
    <header>
    <h1 class="posttitle"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', "presswork" ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
    <h2 class="meta">
    <?php
    the_time(get_option('date_format')); //we keep the time only
    ?>
    </h2>
    </header>
    <div class="storycontent">
    <?php
    if(function_exists('has_post_format') &&
    (has_post_format('aside') || has_post_format('link') || has_post_format('video') || has_post_format('image') || has_post_format('audio'))) {
    // new aside || link || audio || video || image post format
    echo '<div class="pformat clear">';
    if(function_exists('has_post_format') && has_post_format('image')) {
    if(function_exists('has_post_thumbnail') && has_post_thumbnail()) {
    echo '<a href="'.get_permalink().'">';
    the_post_thumbnail('medium', array('class'=>'alignleft'));
    echo '</a>';
    } else {
    the_content('');
    }
    } else {
    the_content('');
    }
    echo '</div>';
    } elseif(function_exists('has_post_format') && has_post_format('gallery')) { // new gallery post format
    global $post;
    $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
    if ( $images ) :
    $total_images = count( $images );
    $image = array_shift( $images );
    $image_img_tag = wp_get_attachment_image( $image->ID, 'full' );
    ?>
    <a class="gallery-thumb" href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
    <p class="gallery-text clear fl"><em><?php printf( _n( 'This gallery contains <a %1$s>%2$s photo &rarr;</a>', 'This gallery contains <a %1$s>%2$s photos &rarr;</a>', $total_images, "presswork" ),
    'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', "presswork" ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"',
    number_format_i18n( $total_images )
    ); ?></em>
    </p>
    <?php endif; ?>
    <?php
    } else {
    if(function_exists('has_post_thumbnail') && has_post_thumbnail()) {
    echo '<a href="'.get_permalink().'">';
    if(is_home()) $thumb = 'fifty'; else $thumb = 'thumbnail';
    the_post_thumbnail($thumb, array('class'=>'alignleft'));
    echo '</a>';
    }
    the_excerpt();
    }
    if(function_exists('has_post_format') && (has_post_format('aside') || has_post_format('link') || has_post_format('gallery'))) { // new aside || link post format
    // do nothing
    } else {
    echo '<a href="'.get_permalink().'" class="more-link">'.__("Read more &rarr;", "presswork").'</a>';
    }
    ?>
    </div>
    <?php
    }
    remove_action('pw_archive_post_middle', 'pw_posts');
    remove_action('pw_author_post_middle', 'pw_posts');
    remove_action('pw_category_post_middle', 'pw_posts');
    remove_action('pw_search_post_middle', 'pw_posts');
    remove_action('pw_index_post_middle', 'pw_posts');
    add_action('pw_archive_post_middle', 'new_pw_posts');
    add_action('pw_author_post_middle', 'new_pw_posts');
    add_action('pw_category_post_middle', 'new_pw_posts');
    add_action('pw_search_post_middle', 'new_pw_posts');
    add_action('pw_index_post_middle', 'new_pw_posts');


    That should be it. Don't forget to enclose all this code between <?phpand ?>
    image PressWork Support Moderator
  • @cestbibi Greatness! Now it's without author and category, and comments in combination with your (9) and (12). I really appreciate your kindness and patience!