Using WP Show Posts

| |

China Underground > Uncategorized > Using WP Show Posts

Adding post lists and grids to your Site couldn’t be easier than with the WP Show Posts plugin. Dispatch uses the Free version to display posts on the Front page and in the Sidebars. Of course with a little Flint Skin CSS treatment.

Head off to Dashboard > WP Show Posts > All Lists. Within are six lists:

  • Align
  • Standard
  • Sidebar
  • Header
  • Simple
  • Simple Sidebar

Each of them have very particular settings required to match the demo content you see here. Changing those settings may affect the way the post is displayed, and not necessarily for the better. So please work on a duplicate or make a note before changing.

Note: the name of the List has no relevance to the different styles displayed.

General ( and important ) information

Before we go into the detail let’s cover some basic and very important information.

Advanced Settings

For the purpose of the demo content a couple of the Lists are using Advanced Settings. First off the Standard List is using Ascending Order (Default: Descending).  Secondly the Simple List is using Offset, so it omits the first 4 posts. You may want to put these back to default if you’re not intending to replace them.

Duplicating WP Show Posts List

So we have four lists, and we want to make a new Standard list with a different category. The easiest way is to use one of the Duplicate Post plugins in the WordPress repository. Simple hey. And it works for all post types including GP Elements. Awesome. Note: When making a duplicate you are generally given two options. Clone and New Draft. I advise using the New Draft as some people have reported issues when using Clone.

 

List: Standard

This is the standard WP Show Post list that has the same custom styling applied to the GP Blog:

This is how the list is displayed within the Content area just by adding the WP Show Post Shortcode. Here follows the basic styling changes that have been made.

Content Wrap (WPSP Only)

Using a custom Hook Element the Post article content is now wrapped within a DIV container. This container carries a class of wpsp-content-wrap for styling. This wrap is present on all WP Show Posts that are output inside Dispatch.

Featured Image

The featured image has a fixed height to match the layout. This is achieved using this CSS:


.generate-columns-container article .inside-article img,  .wp-show-posts-image img {
    height: 180px;
    width: 100%;
    -o-object-fit: cover !important;
    object-fit: cover !important;
}

You can edit the height property to suit, or remove the CSS it entirely if you want to use your own sizes.

Meta above title

This is achieved using a flex box on the Entry Header. Again this applied to the GP Blog:


.generate-columns-container article .entry-header, .wp-show-posts-entry-header {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: reverse;
    -ms-flex-direction: column-reverse;
    flex-direction: column-reverse;
}

Entry Title forced to 2 lines

The entry title always displays a minimum and maximum of 2 lines. This mantains the across row alignment. Again this is applied to GP Blog. The ex unit is used to define the number of lines visible. The lines are set by defining the line-height and setting the height to as many mutiples as you require lines. e.g up the height to 7.5ex will create three lines.


.generate-columns-container article .entry-header .entry-title, .wp-show-posts article .wp-show-posts-entry-title {
    line-height: 2.5ex;
    height: 5ex;
    overflow: hidden;
    text-overflow: ellipsis;
}

 

List: Align

Designed for a single column list this displays the content the image to the left and content to the right. This is subtly different to just resizing the image in the WP Show Posts list settings and aligning it left. Thanks to the Content Wrap we added (above) the content will never wrap around the image. On mobile it just stacks.

To add one of these your posts requires a little markup. And is done like so:

<div class="wpsp-align">shortcode_goes_here</div>

Forgotten Places: Kowloon Walled City

Kowloon Walled City was a densely populated and ungoverned area in Hong Kong. Originally a fortress, in 1898 the Walled City became an enclave after the New Territories were given to Britain by China. Related articles: China Suburbia, an examination of suburban life in Yunnan, China; History of Hong Kong cinema The population grew rapidly…

Rare pictures of the Korean War

The Korean War (Korean: 한국 전쟁, Chinese: 朝鲜战争), was a conflict between North Korea, supported by China and the Soviet Union, and South Korea, supported by the United Nations and the United States. In the three years of the conflict, about three million people died, most of them civilians. The war began on June 25,…

Interview with Media Artist and Designer Jiayu Liu

Jiayu Liu is a designer and media artist, interested in physical data visualization and interactive code. Jiayu Liu is London and Beijing-based media artist that creates artwork using some custom algorithm to extract data in real-time. She was born in Liaoning, China and she earned an MA at the Royal College of Art. Her work…

The Sino-Indian War of 1962 in pictures (50 images)

The Sino-Indian war (中印边境战争) was a military conflict fought between China and India in 1962 over control of the Himalayan border. Since the Tibetan uprising of 1959, when India guaranteed diplomatic asylum to the Dalai Lama, a series of violent clashes followed along the border between the two countries. By 1960, India had begun a…

Interview with Deadly Cradle Death

Deadly Cradle Death is an experimental, electronic, no wave, hip-hop duo, They formed in 2011 when He Fan (Birdstriking, Carsick Cars) met at a concert Liu Xingyu (Chui Wan). Where does the name ‘Deadly Cradle Death’ come from? Liu Xingyu (LXY):”Crib your enthusiasm” is one of the episodes of “1000 ways to die”, an American…

Interview with Glass Artist Meng Du

She is a glass artist that captures with her artworks untouchable moments that she would not like to forget. Meng Du graduated from Central Academy of Fine Arts’s Graphic Design department, Beijing, fell in love with glass after seeing Chihuly’s exhibition and moved to the U.S.A. for M.A. in Glass Making at Rochester Institute of…

 

Lists: Sidebar

In the right had sidebar you can see the Sidebar list. This List is set to 1 column and only displays the Featured Image, Title and Category. This is designed for Widgets, a narrow column or as part of a grid (like in our next List).

To add this style the Widget requires a CSS Class of:

wpsp-card

Dispatch comes with Widget Classes Plugin installed. This provides this function.

 

List: Header

The Header list as seen on the Front Page requires a list containing only 5 posts. And can accomodate most of the content elements. Which are only displayed on the large leader post.

To add this style the Header Element requires the following element classes:

wpsp-grid wpsp-card

List: Simple

This is output using the wpsp-card inserted into a containing DIV like so:

<div class="wpsp-card">shortcode goes here</dib>

 

List: Simple Sidebar

Nothing fancy here,  just a list being output using the a Widget in the sidebar.

 

 

 


Subscribe to China Underground and get the free magazine 'Planet China'

* indicates required

View previous campaigns.

By clicking Sign Up, you agree to our terms and conditions.

You can unsubscribe at any time by clicking the link in the footer of our emails.

We use Mailchimp as our marketing platform. By clicking below to subscribe, you acknowledge that your information will be transferred to Mailchimp for processing. Learn more about Mailchimp's privacy practices here.

Previous

China legalizes re-education camps for “religious extremists” in Xinjiang province

UPDATED – Cui Yongyuan, the anchorman who accused Fan Bingbing, disappeared after accusing Shanghai police of fraud

Next