Skip to content
View in the app

A better way to browse. Learn more.

JimiWikman.se

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Wordpress 3.1 - Post format

Med Wordpress 3.1 så kommer ytterligare ett sätt att hantera innehåll, nämligen post format.

 

Postformat är kort sagt ett sätt att särskilja olika typer av poster och om man vill ge varje typ en unik design. Personligen tycker jag det känns lite överflödigt när vi redan har custom post types om du vill separera olika innehåll för att skapa ett galleri och ett nyhetsflöde till exempel, men visst kan det ha sina användningsområden.

 

Ett exempel kan till exempel vara att poster som innehåller video eller grafik får ett specifikt utseende som är mer anpassat för just det innehållet och det är ju användbart.

 

Som vanligt för nya typer av innehåll så måste du lägga till funktionen i filen functions.php:

 

//Lägg till stöd för post format
add_theme_support( 'post-formats', array( 'aside', 'chat', 'gallery', 'image', 'link', 'quote', 'status','video', 'audio' ) );

 

Sedan så kan du lägga in conditional tags i koden för att forma layouten för olika posttyper som du vill. Lisa Sabin-Wilson har ett exemple på hur det kan se ut:

 




>
		if ( has_post_format( 'aside' )) {
			echo the_content();
		}

		elseif ( has_post_format( 'chat' )) {
			echo '';
 				echo the_title();
			echo '';
			echo the_content();
		}

		elseif ( has_post_format( 'gallery' )) {
			echo '';
 				echo the_title();
			echo '';
			echo the_content();
		}

		elseif ( has_post_format( 'image' )) {
			echo '';
 				echo the_title();
			echo '';
				echo the_post_thumbnail('medium');
			echo the_content();
		}

		elseif ( has_post_format( 'link' )) {
			echo '';
 				echo the_title();
			echo '';
			echo the_content();
		}

		elseif ( has_post_format( 'quote' )) {
			echo the_content();
		}

		elseif ( has_post_format( 'status' )) {
 				echo the_content();
		}

		elseif ( has_post_format( 'video' )) {
			echo '';
 				echo the_title();
			echo '';
			echo the_content();
		}

		elseif ( has_post_format( 'audio' )) {
			echo '';
 				echo the_title();
			echo '';
			echo the_content();
		}

		else {
			echo '';
 				echo the_title();
			echo '';
			echo the_content();
		}
	?>



 

Jag misstänker att vi kommer att se att folk kommer att blanda post types och post format för olika ändamål, något som i slutändan kommer att bli förvirrande för dom som är nya på Wordpress och jag hade hellre sett att Wordpress fokuserade på annat, som ett utvecklat system för att hantera användare och ommunity funktioner, men det kanske kommer i framtiden.

User Feedback

Recommended Comments

There are no comments to display.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.