Welcome to PressWork!

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

In this Discussion

Show Full Content of ALL posts on homepage
  • Hi,

    I've stumbled through creating a child theme for pressworks and tried unsuccessfully to implement the code found here many times:

    http://support.presswork.me/discussion/493/help-me-read-more

    I'd like to show the full content of all posts displayed on the homepage, but keep the featured image above the title for the very first post.

    So far, the only things I can successfully do are show the full text for all pages UNDER the top 2 featured posts, or make all posts look like the first featured post.

    Please help.
  • You want to rewrite the post content functions for the featured post and the rest:
    <?php
    function custom_pw_posts_featured() {
    echo pw_function_handle(__FUNCTION__);
    global $pw;
    $rightcon = '';
    $bool = true;
    if(function_exists('has_post_thumbnail') && has_post_thumbnail() && (function_exists('has_post_format') && !has_post_format('gallery') && !has_post_format('video') && !has_post_format('image'))) {
    echo '<a href="'.get_permalink().'" class="image-anchor">';
    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"';
    } else {
    if(has_post_format("image")) $bool = false;
    }
    ?>
    <div<?php echo $rightcon; ?>>
    <?php pw_post_header(); ?>
    <?php custom_pw_post_content($bool); ?>
    </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', 'custom_pw_posts_featured');
    add_action('pw_index_featured_post_middle', 'custom_pw_posts_featured');
     
    function custom_pw_post_content($ignore_image = false, $excerpt_length = 55, $hide_readmore = false, $display_excerpt = false) {
    echo pw_function_handle(__FUNCTION__);
    ?>
    <div class="storycontent">
    <?php
    if(function_exists('has_post_format') && !is_singular()) {
    $format = get_post_format();
    if(empty($format) || has_post_format('image')) {
    if(has_post_format('image')) $size = 'full'; elseif(empty($ignore_image)) $size = 'small'; else $size = 'thumbnail';
    if(function_exists('has_post_thumbnail') && has_post_thumbnail()) {
    if(empty($ignore_image) || has_post_format('image')) {
    echo '<a href="'.get_permalink().'" class="image-anchor">';
    the_post_thumbnail($size, array( 'class' => 'alignleft' ));
    echo '</a>';
    }
    } else {
    if(has_post_format('image'))
    the_content();
    }
    if(empty($format)) {
    the_content('Read more &rarr;');
    }
    } elseif(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 alignnone" href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
    <p class="gallery-text clearfix 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 {
    // new aside || link || audio || video || image post format
    echo '<div class="pformat clearfix">';
    the_content('');
    echo '</div>';
    }
    }
    ?>
    </div>
    <?php
    }
    remove_action('pw_index_post_middle', 'pw_post_content', 11);
    add_action('pw_index_post_middle', 'custom_pw_post_content', 11);
    Post edited by cbavota at 2012-03-30 10:29:12
    image Senior Developer & Co-Founder of PressWork
  • I am a total newbie with this web building thing and the last time I tried to do the above, the whole site went into an error. My problem is that my posts only show the words without the pictures I attached. The pictures only show up when you click the 'read more'. Without the pictures, the site looks bland and I really do love your theme and don't want to use another. Help.
  • You need to add your image to the Featured Image selector so that it will appear on the home page. Read this: http://codex.wordpress.org/Post_Thumbnails
    image Senior Developer & Co-Founder of PressWork