Title: Swithcing content
Last modified: August 24, 2016

---

# Swithcing content

 *  Resolved [rookdesigns](https://wordpress.org/support/users/rookdesigns/)
 * (@rookdesigns)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/swithcing-content/)
 * Hello there
 * I am making a website which will have summer and winter content, on each page.
   I am looking for advice on the best way of doing this?
 * I have been thinking of having multiple contents for each page, one titled winter
   and one titled summer, then the editor would add the appropriate content in each
   section.
 * On the front end, there would a be two buttons, one title summer and one winter,
   when the relevant button was clicked the relevant content would be displayed,
   any ideas on the best way of doing this?
 * Any help very much appreciated
 * Best
 * Harry

Viewing 9 replies - 1 through 9 (of 9 total)

 *  [Dan Farrow – moved to @danfarrow](https://wordpress.org/support/users/squarebracket/)
 * (@squarebracket)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/swithcing-content/#post-6059906)
 * hi there, there are many ways of achieving this! It sounds as if your pages will
   need to include the HTML for both summer & winter content which can then be switched
   using a JavaScript toggle. So your final HTML markup might look something like
   this:
 *     ```
       <div class="summer-content">
           Summer stuff here...
       </div>
       <div class="winter-content">
           Winter stuff here...
       </div>
       ```
   
 * It would then be quite simple to write a script to toggle between these two.
 * As to how you manage this content from WordPress, the simplest way would be to
   just switch to text mode and add the HTML right there!
 * The next simplest option would be to add a custom field for the Winter content,
   then update your theme’s `loop.php` to output the post content & the custom field
   content wrapped in the appropriate HTML.
 * If you want it to be friendlier / less technical you could find a plugin that
   allows you to add nicely labelled custom fields to the Post edit page. I often
   use [Pods](http://pods.io) for this kind of thing but there are others available.
 * Hope that helps
    Dan
 *  Thread Starter [rookdesigns](https://wordpress.org/support/users/rookdesigns/)
 * (@rookdesigns)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/swithcing-content/#post-6059914)
 * Hi Dan
 * cheers for that I’ll look into it, seems like custom fields in conjunction with
   the main content is the best option, thanks for your advice.
 * Best
 * Harry
 *  Thread Starter [rookdesigns](https://wordpress.org/support/users/rookdesigns/)
 * (@rookdesigns)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/swithcing-content/#post-6059961)
 * Hi Dan
 * Great advice, I used advanced custom fields in the end to make the summer content
   and use the standard page content for the winter one. Then it turns out the theme
   i’m using(Virtue theme) has built in tab toggle functionality, so I then wrapped
   the content and the custom field in the appropriate html. The only issue i’m 
   facing now is, I want a way for the the tabs to be wrapped in an if statement,
   i’m not to sure how to do that.
 * I basically have this html for the two tabs:
 *     ```
       <ul class="nav nav-tabs sc_tabs">
                       <li class="active"><a href="#winter">Winter</a></li>
                                   <li class=""><a href="#summer">Summer</a></li>
                                 </ul>
       ```
   
 * and this to declare the custom field:
 *     ```
       <div class="tab-content postclass">
         <div class="tab-pane clearfix active" id="winter"><?php the_content(); ?></div>
         <div class="tab-pane clearfix" id="summer"><?php the_field('summer'); ?></div>
       </div>
       ```
   
 * Any ideas on how I might make this into an if statement?
 * cheers for your help
 * Best
 * Harry
 *  [Dan Farrow – moved to @danfarrow](https://wordpress.org/support/users/squarebracket/)
 * (@squarebracket)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/swithcing-content/#post-6060003)
 * hiya,
    I don’t really understand what you’re asking. What are you trying to achieve
   with the if statement? Dan
 *  Thread Starter [rookdesigns](https://wordpress.org/support/users/rookdesigns/)
 * (@rookdesigns)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/swithcing-content/#post-6060007)
 * Hi Dan
 * What I’m basically trying to do is check if my custom field summer has content
   in it(Images writing whatever) if so then deisplay the ul/li html if not then
   don’t.
 * Does that make more sense?
 * Cheers
 * Dan
 *  [Dan Farrow – moved to @danfarrow](https://wordpress.org/support/users/squarebracket/)
 * (@squarebracket)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/swithcing-content/#post-6060008)
 * Oh I see. Try this:
 *     ```
       <?php
           $summer = get_post_meta( get_the_ID(), 'summer', true );
           if ( !empty( $summer ) ):
       ?>
               <ul class="nav nav-tabs sc_tabs">
                   <li class="active"><a href="#winter">Winter</a></li>
                   <li class=""><a href="#summer">Summer</a></li>
               </ul>
       <?php
           endif;
       ?>
       ```
   
 * Then later in your page template:
 *     ```
       <?php
           if ( !empty( $summer ) ):
       ?>
               <div class="tab-pane clearfix" id="summer">
                   <?php echo( $summer ); ?>
               </div>
       <?php
           endif;
       ?>
       ```
   
 *  Thread Starter [rookdesigns](https://wordpress.org/support/users/rookdesigns/)
 * (@rookdesigns)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/swithcing-content/#post-6060009)
 * Ok cool, cheers dan I’ll try that.
 *  Thread Starter [rookdesigns](https://wordpress.org/support/users/rookdesigns/)
 * (@rookdesigns)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/swithcing-content/#post-6060011)
 * Ha ha you my friend are a legend, thank you very much. I had to change `<?php
   echo( $summer ); ?>` to `<?php echo the_field('summer'); ?>` but that’s only 
   because I’m using advanced custom fields. Thank very much for all your help, 
   cant thank you enough.
 * All the best
 * Harry
 *  [Dan Farrow – moved to @danfarrow](https://wordpress.org/support/users/squarebracket/)
 * (@squarebracket)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/swithcing-content/#post-6060013)
 * You’re welcome, glad it worked out 🙂

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Swithcing content’ is closed to new replies.

## Tags

 * [content](https://wordpress.org/support/topic-tag/content/)
 * [Themes](https://wordpress.org/support/topic-tag/themes/)
 * [toggle](https://wordpress.org/support/topic-tag/toggle/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 9 replies
 * 2 participants
 * Last reply from: [Dan Farrow – moved to @danfarrow](https://wordpress.org/support/users/squarebracket/)
 * Last activity: [11 years, 1 month ago](https://wordpress.org/support/topic/swithcing-content/#post-6060013)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
