Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a post that contains a video (or a slider) and some text.

Is it possible to hide the text on the home page, but still display the rest? How would I do that?

share|improve this question
    
Well, this can either be done by PHP and/or CSS and/or jQuery, so there is not the solution. If you could include the code of your home.php file we could provide you with a fitting solution. Also, do you want to have this for one single post, are there more, or should this effect every post that is displayed on your home page? –  t f Apr 28 '13 at 16:33
add comment

1 Answer

If your video is pasted into the post body, you have a couple of options.

  1. Use a filter on the_content and preg_replace to remove the content.
  2. Wrap your content in a shortcode.

I am going to recommend option #2 because option #1 involves processing markup with regex which is tricky and prone to error, and your question does not contain enough information for me to be able to write that anyway.

function hide_on_home_page_wpse_97587($atts,$content) {
  if (!is_home()) {
    return $content;
  }
}
add_shortcode('nohome','hide_on_home_page_wpse_97587');

Then when you post content put the switched content between [nohome] and [/nohome]

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.