• Resolved ianbee

    (@ianbee)


    Right now, I made my whole wordpress blog display the_excerpt instead of the_content. But, I would like it to show the_content only on the video category page. Right now in the content.php files it grabs the extension “muimedia_post_entry_summary” from my content extensions php file. In my content extensions php file here is the code that gets the excerpt (post_entry_summary)…

    /* muimedia_post_entry_summary */
    if ( !function_exists( 'muimedia_post_entry_summary' ) ) {
    	function muimedia_post_entry_summary() {
    		?>
    		<div class="entry-summary">
    			<?php if (has_post_thumbnail()){ ?>
    			<a href="<?php the_permalink() ?>" title="<?php the_title_attribute( array('before' => esc_attr__( 'Permalink: ', 'muimedia' ), 'after' => '')); ?>" rel="bookmark"><?php the_post_thumbnail(); ?></a>
    			<?php } ?>
    			<div id="categorysummary">
    			<?php the_excerpt(); ?>
    			</div>
    		</div>
    		<?php
    	}
    }

    This code gets each post’s thumbnail and excerpt.. and I’m trying to get it to show the content ONLY on the videos category page. I tried keeping the first code above, duplicating it then changing it to the following:

    /* muimedia_post_entry_summary video page */
    if ( !function_exists( 'muimedia_post_entry_summary' ) && is_category( 'videos' )  ) {
    	 function muimedia_post_video_entry_summary() {
    		?>
    		<div class="entry-content">
    
    			<?php the_content(); ?>
    
    		</div>
    		<?php
    	}
    }

    As you can see I tried the “&& is_category”, I also tired “|| is_category” and also replacing the category name with it’s ID. I don’t really know what else to do ?? If anyone could help me on this small issue it would meann soooo sooo much to me! It really would. I’m going to go eat some after breakfast brunch. But, I will make my return to my computer within the next 30 mins.. Hopefully someone will have the right solution to this somewhat minimal problem! ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • wpismypuppet

    (@wordpressismypuppet)

    I don’t know if you’re using the right function in the right place. I’m also not entirely sure what you are looking for. However, I have an idea that you could try. It looks like you want to use the first function above and use the_excerpt() unless you’re in the “videos” category, correct? Try:

    /* muimedia_post_entry_summary */
    if ( !function_exists( 'muimedia_post_entry_summary' ) ) {
    	function muimedia_post_entry_summary() {
    		?>
    		<div class="entry-summary">
    			<?php if (has_post_thumbnail()){ ?>
    			<a href="<?php the_permalink() ?>" title="<?php the_title_attribute( array('before' => esc_attr__( 'Permalink: ', 'muimedia' ), 'after' => '')); ?>" rel="bookmark"><?php the_post_thumbnail(); ?></a>
    			<?php } ?>
    			<div id="categorysummary">
    			<?php
    				if( in_category( 'videos' ) ) {
    					the_content();
    				}else {
    					the_excerpt();
    				}
    			?>
    			</div>
    		</div>
    		<?php
    	}
    }

    As you can see, the only place I made a change was where you are pumping out the_excerpt(). I added a simple if/else statement to check to see if the post you are looking at is “in” the video category. If you are in that category, show the content, otherwise show the excerpt. Hope this is what you were looking for.

    Thread Starter ianbee

    (@ianbee)

    @wpismypuppet WOOOOWWW thanks so much man! This is exactly, EXACTLY! What I was looking for. And it actually worked ?? Tank you tank you vewie much.

    wpismypuppet

    (@wordpressismypuppet)

    You are welcome! Glad I could help.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Show excerpts on video category page only?’ is closed to new replies.