WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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? – tfrommen Apr 28 '13 at 16:33

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;

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

share|improve this answer

Your Answer


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.