Beskrivning
Note: This plugin requires Posts 2 Posts
Allows you to associate a custom post type (”slides”) with any of your other post
types (defaults to ”pages”). This is useful for theme developers of those that
want to add custom sliders around your theme.
This plugin does not provide you out of the box front end functionality. If you’re
looking for a drop in and play slider, this isn’t it.
Installation
First, install and active Posts 2 Posts.
Then, use the WordPress installer to install this plugin or …
- Click the big orrange button to download the plugin
- Unzip the plugin files
- Upload the
p2p-slidesfolder to your/wp-content/plugins/directory - Activate the plugin in the admin area
After installing, you should see a new meta box on your edit screen for pages.
If you wish to modify what post types get associated with slides, simply hook
into after_setup_theme and add theme support for p2p-slides.
<?php
add_action('after_setup_theme', 'my_special_setup');
function my_special_setup()
{
// this is the same as just having the plugin installed
add_theme_support('p2p-slides');
add_theme_support('p2p-slides', array('a-post-type', 'another-post-type'));
}
To use the slides, you’ll need to check the slides property of each $post.
<?php
// start the loop as normal
while(have_posts()): the_post();
?>
<?php if($post->slides): ?>
We have slides! Loop through them.
<?php foreach($post->slides as $slide): ?>
Do stuff with $slide here, it's just a post object
<?php endforeach; ?>
<?php endif; ?>
<?php endwhile; ?>
You can find a more complete example, in the form of a page template for twentyeleven in the P2P Slides’ inc directory.
Vanliga frågor
- Why no front end prettiness?
-
Because that’s a theme’s job. This plugin is only meant to provide you with
tools to extend your theme or child theme. - Is this Posts 2 Posts legit?
-
Yes. Posts 2 Posts
is amazing.
Recensioner
Detta tillägg har inga recensioner.
Bidragsgivare och utvecklare
”P2P Slides” är programvara med öppen källkod. Följande personer har bidragit till detta tillägg.
Bidragande personerÖversätt ”P2P Slides” till ditt språk.
Intresserad av programutveckling?
Läs programkoden, kika på SVN-filförvaret eller prenumerera på utvecklarloggen via RSS.
Ändringslogg
1.0
- Initial version.
