Remove Featured Image from Blog Page

Working on a client site (HERE).

They are using the COSMOX theme (COSMOX theme).

They can't find their purchase code (which is required for a support question on the publisher's support site).

What I am trying to do is remove the default setting of showing the featured image on the blog page. I looked in the theme settings, but they don't have that option there.

Is there a piece of .css that I can place into the site to stop showing the featured image on the blog page?

Thanks,
Jef

  • Vaughan

    Hi @jeff arnold,

    The above article from @Ajay Aravind should work, however if that's overkill, It could be possible with CSS, it would depend on the page though.

    Do you mean you want the featured image removed from the archive list page only, or from all the posts (archive & single item)

    If you could post a URL to the page you want the featured image removing from, I can take a look at the CSS.

    You could of course also edit the archive template or single.php template and remove the code that references thumbnails.

    such as;

    the_post_thumbnail('post-image');

    Hope this helps

  • jeff arnold

    Vaughan:

    I think you are on target with what I want to do ... I want to remove the image from the blog page, not from the post itself.

    This theme's single.php references the single_blog.php.

    Here is the code that I believe talks about a 'default' posting of the image to the blog page.

    default:
    
                                        $thumb_image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'post-thumb-short'); //thumb image by featured image
    
                                        $large_image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'post-thumb'); //large image by featured image
    
                                        if(is_array($thumb_image) && count($thumb_image) > 0) {
    
                                            echo '<div class="blog-big-photo">' . PHP_EOL;
    
                                            echo '	<a href="' . $large_image[0] . '" title="' . get_the_title() . '" class="colorbox-image">' . PHP_EOL;
    
                                            echo '		<img src="' . $thumb_image[0] . '" width="100%" alt="" class="blog-featured-big-photo" />' . PHP_EOL;
    
                                            echo '		<span><div class="generic-link-button icon-search-1"></div></span>' . PHP_EOL;
    
                                            echo '	</a>' . PHP_EOL;
    
                                            echo '</div>' . PHP_EOL;
    
                                        }

    Can I just comment all this out by putting "//" in front of the $thumb_image and $large_image lines?

    Jeff

  • Jack Kitterhing

    Hi there @jeff arnold,

    Hope you're well today and sorry about the delay here.

    /* default:
    
                                        $thumb_image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'post-thumb-short'); //thumb image by featured image
    
                                        $large_image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'post-thumb'); //large image by featured image
    
                                        if(is_array($thumb_image) && count($thumb_image) > 0) {
    
                                            echo '<div class="blog-big-photo">' . PHP_EOL;
    
                                            echo '	<a href="' . $large_image[0] . '" title="' . get_the_title() . '" class="colorbox-image">' . PHP_EOL;
    
                                            echo '		<img src="' . $thumb_image[0] . '" width="100%" alt="" class="blog-featured-big-photo" />' . PHP_EOL;
    
                                            echo '		<span><div class="generic-link-button icon-search-1"></div></span>' . PHP_EOL;
    
                                            echo '	</a>' . PHP_EOL;
    
                                            echo '</div>' . PHP_EOL;
    
                                        }*/

    Thanks!

    Kind Regards
    Jack.

  • jeff arnold

    Jack:

    Thanks for the update. No problem on the delay ... not urgent, but would like to get it resolved.

    I noticed that the page this client had set up as a blog page was just a 'default template'.

    I put the */ where you indicated, but the featured image was still showing.

    I change the page template type to 'single blog page' and then I got this error:

    Parse error: syntax error, unexpected T_ENDIF in /home/janthony/public_html/wp-content/themes/cosmox/single_blog.php on line 263

    I've changed back to the 'default template' so that the site renders okay, but would like to get this fixed, so if you can look at the attached file (the .php file for the single blog post) and let me know if you see anything that I can fix, I'd appreciate it.

    Thanks,
    Jeff

  • jeff arnold
    <?php
    /*
    Template Name: Single Blog Standard
    */
    
    	get_header();
    
    	//load neccessary styles
    	wp_register_style('portfolio-css', OZY_BASE_URL . '/css/portfolio.css');
    	wp_enqueue_style( 'portfolio-css');	
    
    	/*RELATED ITEMS REQUIRED SCRIPTS*/
    	//masonry plugin
    	wp_enqueue_script('jquery-masonry', OZY_BASE_URL . '/scripts/masonry/jquery.masonry.min.js', array('jquery') );	
    
    	global $myhelper;
    
    	$script = '	jQuery(document).ready(function() {
    					jQuery(function(){
    					  jQuery("#portfolio-related-porjects-wrapper").masonry({
    						itemSelector : ".item",
    						columnWidth : 160
    					  });
    					});
    				});' . PHP_EOL;
    	$script.= '	jQuery(".tooltip").tooltip( {extraClass : "button-face", showURL : false} );';
    
    	$myhelper->set_footer_script( $script );
    	/*RELATED ITEMS REQUIRED SCRIPTS END*/
    
    	//page layout & side bar
    	global $IS_SIDEBAR_ACTIVE;
    	global $SIDE_BAR_TYPE;
    	global $SIDE_BAR_ID;
    
    	$SIDE_BAR_ID 	= $myhelper->read_meta_data ( get_post_meta(get_the_ID(),'ozy_generic_sidebars'));
    	$SIDE_BAR_TYPE 	= $myhelper->read_meta_data ( get_post_meta(get_the_ID(),'ozy_generic_layout_options'));
    	if($SIDE_BAR_TYPE == '' || $SIDE_BAR_TYPE == "full-sidebar" || $SIDE_BAR_ID == '')
    		$IS_SIDEBAR_ACTIVE = false;
    	else if($SIDE_BAR_TYPE == 'left-sidebar' || $SIDE_BAR_TYPE == 'right-sidebar')
    		$IS_SIDEBAR_ACTIVE = true;
    
    	//we need to make different choices for both situtations
    	$IS_TITLE_ENABLED = false;	
    
    	if(have_posts()) : the_post();
    
    		//Show title check
    		if( (int)$myhelper->read_meta_data ( get_post_meta(get_the_ID(),'ozy_generic_super_title_is_enabled') ) !== -1 ):
    			echo '<div id="page-title-wrapper">';
    				echo '<div>';
    					echo '<h1 class="cfnt">';
    						$super_title = get_post_meta(get_the_ID(), "ozy_generic_super_title", true);
    						echo trim($super_title) != '' ? $super_title : get_the_title();
    					echo '</h1>';
    					dimox_breadcrumbs();
    				echo '</div>';
    			echo '</div>';
    			$IS_TITLE_ENABLED = true;
    		endif;
    	?>				
    
    	<div id="wrapper-1012">
    	<?php
    		//sub title
    		if( (int)$myhelper->read_meta_data ( get_post_meta(get_the_ID(),'ozy_page_sub_title_is_enabled') ) === 1 ):
    			echo '<div id="sub-title-wrapper">';
    				echo '<div class="' . ( !$IS_TITLE_ENABLED ? 'alone' : 'not-alone' ) . '">';
    					echo '<div>';
    						echo '<h2 class="cfnt">';
    							_e("CATEGORIES : ", "ozy_frontend");
    							the_category(', ');
    						echo '</h1>';
    						$myhelper->post_top_navigation(get_permalink());
    					echo '</div>';
    				echo '</div>';
    			echo '</div>';
    			echo '<div class="clear' . ( !$IS_TITLE_ENABLED ? '' : '45' ) . '"></div>';
    		endif;
    	?>
    
        	<!--clear after title-->
        	<div class="clear30"></div>
            <!--/clear after title-->    
    
    		<!--main wrapper-->
    		<article id="main-wrapper">
    			<?php
    			if($IS_SIDEBAR_ACTIVE) {
    				if($SIDE_BAR_TYPE == "left-sidebar") {
                		echo '
    			<!--left sidebar-->
    			<aside class="left-sidebar sidebar-generic">' . PHP_EOL;
    					if( !function_exists('dynamic_sidebar') || !dynamic_sidebar( $SIDE_BAR_ID . $myhelper->wpml_current_language ) ) : endif;
    					echo '
    			</aside>
    			<!--/left sidebar-->' . PHP_EOL;
    				}				
    
    				echo '
    			<!--content with sidebar-->
    			<section class="page-content-with-sidebars">' . PHP_EOL;
    			}
    			?>
    				<section class="blog-page">
    
    					<?php
    
    					wp_reset_postdata();
    
    					global $more;    // Declare global $more (before the loop).
    
    					$args = array(
    						'tag' => ( isset( $tag ) ? $tag : NULL ),
    						'author' => ( isset( $author ) ? $author : NULL ),
    						'cat' => ( isset( $cat ) ? $cat : NULL ),
    						'post_type' => array( 'post' )
    					);
    
    					echo '<div id="page-content" class="col col-single span_4-4">';
    					?>
    
                        <article id="post-<?php the_ID(); ?>" <?php post_class('blog-post'); ?>>
    
                            <h1 class="blog-post-title"><?php the_title(); ?></h1>
    
                            <?php
                                switch(get_post_format()) {
    
                                    case "video":
                                        $video = $myhelper->video_object_from_url($myhelper->catch_that_video(), "100%", "480px","","");
                                        if($video != '')
                                            echo $video;
    
                                        break;
    
                                    case "gallery":
                                        require_once("functions/layout-objects.php");
                                        $ozyPortfolio = new OzyPortfolio;
    
                                        $photos = get_children( array("post_parent" => get_the_ID(), "post_status" => "inherit", "post_type" => "attachment", "post_mime_type" => "image", "order" => "ASC", "orderby" => "menu_order ID") );
                                        if(is_array($photos) && count($photos) > 0) {
                                            $img_arr = array();
                                            foreach($photos as $photo)
                                                array_push($img_arr, array("image" => $photo->guid, "title" => $photo->post_title));
    
                                            $ozyPortfolio->thumb_slider($img_arr, "-685x260", "portfolio", "image", true, false, true);
                                        }
    
    				    break;						
    
                                   /* default:
                                        $thumb_image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'post-thumb-short'); //thumb image by featured image
                                        $large_image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'post-thumb'); //large image by featured image
    				    if(is_array($thumb_image) && count($thumb_image) > 0) {
                                           echo '<div class="blog-big-photo">' . PHP_EOL;
                                           echo '	<a href="' . $large_image[0] . '" title="' . get_the_title() . '" class="colorbox-image">' . PHP_EOL;
                                           echo '		<img src="' . $thumb_image[0] . '" width="100%" alt="" class="blog-featured-big-photo" />' . PHP_EOL;
                                           echo '		<span><div class="generic-link-button icon-search-1"></div></span>' . PHP_EOL;
                                           echo '	</a>' . PHP_EOL;
                                           echo '</div>' . PHP_EOL;
                                        }
                                        break;
                                }*/
    
                                $more = 1;
    
                                $like_count = (int)$myhelper->read_meta_data ( get_post_meta(get_the_ID(),'ozy_post_like_count') );
                                $comment_count = get_comments_number();
                                $post_date = get_the_date(ot_get_option("ic_blog_date_format"));
    
                                echo '<div class="blog-info-bar-details"><span class="cfnt post-date">' . $post_date . '</span>';
                                echo '<span>&nbsp;&nbsp;' . __('by ','ozy_frontend');
                                the_author_posts_link();
                                echo '</span>';
                                echo '&nbsp;&nbsp;<span class="icon-comment">&nbsp;</span>' . $comment_count . '&nbsp;&nbsp;';
                                echo '<span class="icon-heart" id="' . get_the_ID() . '">&nbsp;</span><span>' . $like_count . '</span>';
                            ?>
                            <!-- AddThis Button BEGIN -->
                            <div class="addthis_toolbox addthis_default_style addthis_32x32_style">
                                <a class="addthis_button_preferred_1"></a>
                                <a class="addthis_button_preferred_2"></a>
                                <a class="addthis_button_preferred_3"></a>
                                <a class="addthis_button_preferred_4"></a>
                                <a class="addthis_button_compact"></a>
                            </div>
                            <script type="text/javascript" src="http://s7.addthis.com/js/300/addthis_widget.js#pubid=xa-505f5bcb401ef5a3"></script>
                            <!-- AddThis Button END -->
                            <?php
                                echo '</div>' . PHP_EOL;
    
                                the_content('');
                            ?>         
    
                            <div class="tag-bar icon-tag"><?php the_tags('',', '); ?></div>
    
                            <div class="clear"></div>
    
                        </article>
    
    					<?php if(ot_get_option('ic_skin_blog_display_related_items') != 'no') : ?>
                        <!--related posts-->
                        <h2 class="cfnt"><?php _e("RELATED POSTS","ozy_frontend"); ?></h2>
    
                        <div id="portfolio-related-porjects-wrapper">
                            <ul>
                                <?php
                                $args = array(
                                    'post_type' 		=> 'post',
                                    'numberposts' 		=> 18,
                                    'my-taxonomy-name' 	=> 'category',
                                    'exclude' 			=> $post->ID,
                                    'orderby' 			=> 'rand',
                                    'meta_key' 			=> '_thumbnail_id'
                                );
                                $posts = get_posts ( $args );
    
                                foreach($posts as $post) :
                                    $thumb_image = wp_get_attachment_image_src( get_post_thumbnail_id(), array(160,9999)); //nothing set on meta boxes, use featured image instead
                                    if(is_array($thumb_image) && count($thumb_image) > 0) {
                                        echo '<li class="item"><a href="' .  get_permalink() . '" title="' . get_the_title() . '" class="tooltip"><img src="' . $thumb_image[0] . '" width="' . $thumb_image[1] . '" height="' . $thumb_image[2] . '" alt=""/></li></a>' . PHP_EOL;
                                    }else{
                                        echo '<li class="item"><img src="' . OZY_BASE_URL . 'images/55x55.png"></li>' . PHP_EOL;
                                    }
                                endforeach;
                                ?>
                            </ul>
                        </div>
                        <!--/related posts-->
    					<?php endif; ?>
    
                        <!--the author-->
    					<?php
    					// If a user has filled out their decscription show a bio on their entries
            			if ( get_the_author_meta('description') ) :
                        ?>
                        <h2 id="authort-box-title"><?php _e('About The Author', 'ozy_frontend') ?></h2>
                        <section class="author-box">
                            <div>
                                <?php echo get_avatar( get_the_author_meta('ID'), 88 ); ?>
                                <p>
                                    <?php echo get_the_author_meta('description'); ?>
                                    <br />
                                    <span><?php _e('View all posts by ', 'ozy_frontend'); the_author_posts_link(); ?></span>
                                </p>
                            </div>
                        </section>
                        <div class="cf clear"></div>
                     	<?php
    					endif;
    					?>
                        <!--/the author-->           
    
                        <?php
    
    					//Comment Form
    					comments_template();
    
    					echo '</div>';
    
    					//Main wrapper - End
    
    					endif;
    					?>
    					<!--clear-->
    					<div class="cf clear"></div>
    
    				</section>
                    <!--/page-wrapper-->
    			<?php
    			if($IS_SIDEBAR_ACTIVE) {
                	echo '
    			</section>
    			<!--/content with sidebar-->' . PHP_EOL;
    
    				if($SIDE_BAR_TYPE == "right-sidebar") {
                		echo '
    			<!--right sidebar-->
    			<aside class="right-sidebar sidebar-generic">' . PHP_EOL;
    					if( !function_exists('dynamic_sidebar') || !dynamic_sidebar( $SIDE_BAR_ID . $myhelper->wpml_current_language ) ) : endif;
    					echo
    			'</aside>
    			<!--/right sidebar-->' . PHP_EOL;
    				}
    			}
    			?>
    
    		</article>
    		<!--/main-wrapper-->
    
    		<!--clear-->
    		<div class="cf clear"></div>
    
        </div>
        <!--end of wrapper-1012-->
    
    	<!--clear-->
    	<div class="cf clear"></div>
    
    <?php
    
    get_footer();
    ?>
  • Vaughan

    Hi @jeff arnold,

    You have the closing */ in the wrong place.

    /* default:
                                        $thumb_image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'post-thumb-short'); //thumb image by featured image
                                        $large_image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'post-thumb'); //large image by featured image
    				    if(is_array($thumb_image) && count($thumb_image) > 0) {
                                           echo '<div class="blog-big-photo">' . PHP_EOL;
                                           echo '	<a href="' . $large_image[0] . '" title="' . get_the_title() . '" class="colorbox-image">' . PHP_EOL;
                                           echo '		<img src="' . $thumb_image[0] . '" width="100%" alt="" class="blog-featured-big-photo" />' . PHP_EOL;
                                           echo '		<span><div class="generic-link-button icon-search-1"></div></span>' . PHP_EOL;
                                           echo '	</a>' . PHP_EOL;
                                           echo '</div>' . PHP_EOL;
                                        }
                                        break;
                                }*/

    The */ at the end needs to be after the break; but before the closing brace of the switch()

    /* default:
                                        $thumb_image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'post-thumb-short'); //thumb image by featured image
                                        $large_image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'post-thumb'); //large image by featured image
    				    if(is_array($thumb_image) && count($thumb_image) > 0) {
                                           echo '<div class="blog-big-photo">' . PHP_EOL;
                                           echo '	<a href="' . $large_image[0] . '" title="' . get_the_title() . '" class="colorbox-image">' . PHP_EOL;
                                           echo '		<img src="' . $thumb_image[0] . '" width="100%" alt="" class="blog-featured-big-photo" />' . PHP_EOL;
                                           echo '		<span><div class="generic-link-button icon-search-1"></div></span>' . PHP_EOL;
                                           echo '	</a>' . PHP_EOL;
                                           echo '</div>' . PHP_EOL;
                                        }
                                        break;*/
                                }

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.