Title: Custom Post Carousels with Owl
Author: thehowarde
Published: <strong>2018 年 8 月 24 日</strong>
Last modified: 2026 年 1 月 9 日

---

搜索插件

![](https://ps.w.org/dd-post-carousel/assets/banner-772x250.png?rev=1929447)

![](https://ps.w.org/dd-post-carousel/assets/icon-128x128.png?rev=1929447)

# Custom Post Carousels with Owl

 作者：[thehowarde](https://profiles.wordpress.org/thehowarde/)

[下载](https://downloads.wordpress.org/plugin/dd-post-carousel.1.4.12.zip)

 * [详情](https://cn.wordpress.org/plugins/dd-post-carousel/#description)
 * [评价](https://cn.wordpress.org/plugins/dd-post-carousel/#reviews)
 *  [安装](https://cn.wordpress.org/plugins/dd-post-carousel/#installation)
 * [开发进展](https://cn.wordpress.org/plugins/dd-post-carousel/#developers)

 [支持](https://wordpress.org/support/plugin/dd-post-carousel/)

## 描述

This plugin uses the Owl-Carousel-2 jQuery plugin to create carousels (sliders) 
from any built in or (public) custom post type in WordPress. You can use this plugin
to make:

 * Image Carousel from Media Library
 * Product Carousels (Choose WooCommerce Products)
 * Featured Product Carousels
 * Carousels from Posts or Products by ID
 * Taxonomy (Category/Tag) Carousels
 * Carousel from _Any Custom Post Type_
 * Latest Posts
 * WooCommerce Reviews
 * More

Easy to use controls allow for customization of each carousel with options to show
or hide Titles, Featured Image, Call to Action buttons (links) and more.

This plugin is simple and without on screen nags, promotions or upsells.

Please note. There is not a lot of stylesheet attached to the layout. If you don’t
have basic skills, this might not be the plugin for you.

## 屏幕截图

[⌊Admin View of a Featured Product Carousel⌉⌊Admin View of a Featured Product Carousel⌉[

Admin View of a Featured Product Carousel

[⌊Admin View of choosing by post ID.⌉⌊Admin View of choosing by post ID.⌉[

Admin View of choosing by post ID.

[⌊Admin View of Chosen Category⌉⌊Admin View of Chosen Category⌉[

Admin View of Chosen Category

[⌊Public Large Desktop View. With Featured Image and CTA Link to item.⌉⌊Public Large
Desktop View. With Featured Image and CTA Link to item.⌉[

Public Large Desktop View. With Featured Image and CTA Link to item.

## 安装

This section describes how to install the plugin and get it working.

 1. Upload `owl-carousel-2.php` to the `/wp-content/plugins/` directory
 2. Activate the plugin through the ‘Plugins’ menu in WordPress
 3. Click on the menu item called `Carousels`
 4. Create your carousel.
 5. Copy the Shortcode and place in your page or post, or place `<?php echo do_shortcode('[
    dd-owl-carousel id="1" title="Carousel Title"]'); ?>` in your templates

## 常见问题

### I made the carousel, but now I can’t see it.

Make sure you insert the shortcode created by the plugin.

### Can I use multiple carousels on a single page?

Yes, you can use as many as you want. Each one will have it’s own CSS ID so you 
can target them in your custom CSS files if you need to.

### Are there programming Hooks?

Yes, there are 2 hooks. One is before the carousel contents, and the other is after
the contents. There will be more enhancement to this at a later date.

 1. dd-carousel-before-content
 2. dd-carousel-after-content

These hooks pass 1 parameter which is $carousel_ID if needed.

Example to add pricing for WooCommerce Carousels – Add to your theme functions.php:

    ```
    <?php
        function add_wc_price_to_carousel(){
        global $post, $woocommerce;
        $product = wc_get_product( $post->ID );
        if ($product) {
            echo '<p class="price">$' . $product->get_price() . '</p>' ;
            echo '<a href="'.get_permalink( $post->ID ).'" class="btn btn-primary ">Shop Now</a>';
            }
        }
        add_action('dd-carousel-after-content', 'add_wc_price_to_carousel', 10);
    ```

### Can I Filter the Query Arguments?

Yes, there is currently one filter.

 * dd_carousel_filter_query_args

This filter passes 2 variables. `$args` the current arguments of the WP_Query and`
$carousel_id` which is the ID of the carousel you want to filter.

Example to create your own custom Query – Add to your theme functions.php :

    ```
    <?php
    add_filter('dd_carousel_filter_query_args', 'filter_carousel', 10, 2);
    function filter_carousel($args, $carouselID){
        if ($carouselID == 9803){
        $args = array(
            'post_type'              => array( 'post' ),
            'meta_query'             => array(
                    'relation' => 'AND',
                    array(
                        'key'     => '_chosen_store',
                        'value'   => '1',
                        'compare' => '>=',
                        'type'    => 'NUMERIC',
                    ),
                ),
            );
        return $args;
        }
    }
    ```

### Are there other filters available?

There are currently several filters available to you. You can apply these in your
theme’s functions.php

 1.  `dd_carousel_filter_excerpt` ($excerpt, $carousel_id)
 2.   * `$excerpt` : string the excerpt
      * `$carousel_id` int the post ID of the carousel.
 3.  `dd_filter_owl_carousel_script` ($owl_script, $carousel_id)
 4.   * `$owl_script` string the jQuery function that invokes the Owl Carousel
      * `$carousel_id` int the post ID of the carousel.
 5.  `dd_carousel_filter_title_heading` ($heading)
 6.   * `$heading` string – use any additional valid HTML tag to wrap the title that
        isn’t already present.
 7.  `dd_carousel_filter_prev` and `dd_carousel_filter_next`
 8.   * This might be helpful to include a fontawesome or other icon set as the Prev/
        Next buttons
 9.  `dd_carousel_filter_caption` ($the_caption, $caption)
 10.  * `$the_caption` – The HTML wrapper and caption for an image carousel
      * `$caption` The `wp_get_attachment_caption` caption for the image

Example of script filter:

    ```
    <?php
    apply_filters('dd_filter_owl_carousel_script', 'my_filter_owl_carousel_script', 10 , 2);
    function my_filter_owl_carousel_script($script, $carousel_id){
        // Do stuff
        return $script;
    }
    ?>
    ```

## 评价

![](https://secure.gravatar.com/avatar/57d84b95c49fbe0ad814c9b6eeb9df7f012fd4a06cea4c8efa0d1532240bf2a4?
s=60&d=retro&r=g)

### 󠀁[WOW](https://wordpress.org/support/topic/wow-964/)󠁿

 [bodopio](https://profiles.wordpress.org/bodopio/) 2023 年 10 月 14 日

Excellent plugin with a lot of options. Worked for me immediatley without any problems.
I show posts as a enterprise history. Thank you for this. The donat button shows
me the duckdiverllc.com site. But how can I donate?

![](https://secure.gravatar.com/avatar/65146f2aee2be1ba7e6014c47e6e9bf0cf0bf9ecb7c70bec1a29595e833d42d4?
s=60&d=retro&r=g)

### 󠀁[Unwillingness of developer to improve plugin](https://wordpress.org/support/topic/unwillingness-of-developer-to-improve-plugin/)󠁿

 [Lee](https://profiles.wordpress.org/leecollings/) 2021 年 11 月 3 日 2 回复

I’ve given two stars because whilst the plugin does perform a good feature, it’s
extremely limited in the sense that the JS is not properly enqueued, so if like 
me you develop your own theme, or use an optimisation plugin, and use different 
ordering of JS and CSS enqueueing, then this plugin is likely to not work. This 
is because the JS options are hard coded and echoed out directly onto the page, 
regardless of where the initial jQuery call is. This has rendered the plugin completely
useless on my site because it’s not using recommended Wordpress enqueue practices.
https://developer.wordpress.org/reference/functions/wp_enqueue_script/#usage

![](https://secure.gravatar.com/avatar/5b50fe8e56e0926fec3033de222ca240bd68808cc6c19cf31e56f1efc64f0af8?
s=60&d=retro&r=g)

### 󠀁[Eccellente](https://wordpress.org/support/topic/eccellente-64/)󠁿

 [webigelv](https://profiles.wordpress.org/webigelv/) 2021 年 10 月 6 日

Semplice, flessibile e supporta la visualizzazione dei caroselli degli articoli 
riservati agli utenti registrati anche per i visitatori non registrati. Quest’ultima
è un’ottima caratteristica. Mi sembra un plug-in molto ben fatto. Grazie per averlo
messo a disposizione gratuitamente.

![](https://secure.gravatar.com/avatar/f4ab3477def590e4e2ae87a40e50e47349ceb19b59da2ab8e376c3dd11c84a62?
s=60&d=retro&r=g)

### 󠀁[Great Stuff !](https://wordpress.org/support/topic/great-stuff-372/)󠁿

 [iceninexp](https://profiles.wordpress.org/iceninexp/) 2021 年 7 月 17 日

I really appreciate the work you’ve put into this plugin! I found it quite straightforward
to be able to create modals of post types as opposed to just displaying to the image.
Great choice to use featherlight! Thanks so much!

![](https://secure.gravatar.com/avatar/c91c996f8eb8bff9fce6cf85b566ee0ad7147573ecf39d0aea1b6cf6d1e96702?
s=60&d=retro&r=g)

### 󠀁[Life Savior](https://wordpress.org/support/topic/life-savior-7/)󠁿

 [ShriniKannan](https://profiles.wordpress.org/shrini/) 2021 年 6 月 30 日

Thanks for the great plugin, actually you made a premium level feature in free plugin
i.e especially CPT Please constantly develop this plugin but I am not sure how the
background coding are !

![](https://secure.gravatar.com/avatar/162c033dee1bb68966b4e549cd284d8bd64aebb1d078c1b26d525291c4cf74ac?
s=60&d=retro&r=g)

### 󠀁[Great Plugin](https://wordpress.org/support/topic/great-plugin-31350/)󠁿

 [emanuelesviluppoweb](https://profiles.wordpress.org/emanuelesviluppoweb/) 2021
年 6 月 29 日

Really great plugin, and great support. Highly recommended!

 [ 阅读所有17条评价 ](https://wordpress.org/support/plugin/dd-post-carousel/reviews/)

## 贡献者及开发者

「Custom Post Carousels with Owl」是开源软件。 以下人员对此插件做出了贡献。

贡献者

 *   [ thehowarde ](https://profiles.wordpress.org/thehowarde/)

[帮助将「Custom Post Carousels with Owl」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/dd-post-carousel)

### 对开发感兴趣吗?

您可以[浏览代码](https://plugins.trac.wordpress.org/browser/dd-post-carousel/)，
查看[SVN仓库](https://plugins.svn.wordpress.org/dd-post-carousel/)，或通过[RSS](https://plugins.trac.wordpress.org/log/dd-post-carousel/?limit=100&mode=stop_on_copy&format=rss)
订阅[开发日志](https://plugins.trac.wordpress.org/log/dd-post-carousel/)。

## 更新日志

#### 1.4.12

Fix featherlight.js to prevent XSS being passed through the data-featherlight param.
Fixes CVE-2024-5667

#### 1.4.6

Various fixes for sanitiziation filters.

#### 1.4.4

Allow SVG in Prev / Next buttons

#### 1.4.2

Security fixes

#### 1.4.1

Add image alt text (if added to image in media library)

#### 1.4

Added Lazy Loading as an option to all carousels (enabled by default). It is recommended
you review your carousels to ensure settings are as you expect. Combined and minified
front end styles.

#### 1.3.1

Fix image issue on Taxonomy Carousel

#### 1.3

Add “Media/Image” Carousel with choose media items. Additional filters added for
convenience.

#### 1.2.6

Add two additional filters `dd_filter_owl_carousel_script` and `dd_carousel_filter_excerpt`

Fix for CPT adding meta to all posts.

#### 1.2.5

Fix Random

#### 1.2.4

Fix for Elementor

#### 1.2.2

Fix missing param in filter

#### 1.2.1

Fix – Admin enqueue stylesheets only on carousel pages/edit.

#### 1.2

Add Parameter to action hooks for carousel ID.

#### 1.1.1

Minor fix on admin switching between Product choices.

#### 1.1

Added Taxonomy Carousel and filter for main Query.

#### 1.0.8

Fix issue with multiple WC Categories

#### 1.0.7

Add multi selection for Taxonomy Terms.

#### 1.0.6

Add Placeholder image for no-image

#### 1.0.4

Fix Error with AQ Resize

#### 1.0.3

Add Thumbnail Image Sizes

#### 1.0.2

Allow for empty excerpt under title.

#### 1.0.1

Change admin script to only enqueu on carousel custom post type.

#### 1.0

Initial Release

## 额外信息

 *  版本 **1.4.12**
 *  最后更新：**5 月前**
 *  活跃安装数量 **2,000+**
 *  WordPress 版本 ** 4.5 或更高版本 **
 *  已测试的最高版本为 **6.9.4**
 *  PHP 版本 ** 7.0 或更高版本 **
 *  语言
 * [English (US)](https://wordpress.org/plugins/dd-post-carousel/)
 * 标签
 * [Image carousel](https://cn.wordpress.org/plugins/tags/image-carousel/)[post carousel](https://cn.wordpress.org/plugins/tags/post-carousel/)
   [post slider](https://cn.wordpress.org/plugins/tags/post-slider/)[product slider](https://cn.wordpress.org/plugins/tags/product-slider/)
 *  [高级视图](https://cn.wordpress.org/plugins/dd-post-carousel/advanced/)

## 评级

 4.6 星（最高 5 星）。

 *  [  15 条 5 星评价     ](https://wordpress.org/support/plugin/dd-post-carousel/reviews/?filter=5)
 *  [  0 条 4 星评价     ](https://wordpress.org/support/plugin/dd-post-carousel/reviews/?filter=4)
 *  [  0 条 3 星评价     ](https://wordpress.org/support/plugin/dd-post-carousel/reviews/?filter=3)
 *  [  1 条 2 星评价     ](https://wordpress.org/support/plugin/dd-post-carousel/reviews/?filter=2)
 *  [  1 条 1 星评价     ](https://wordpress.org/support/plugin/dd-post-carousel/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/dd-post-carousel/reviews/#new-post)

[查看全部评论](https://wordpress.org/support/plugin/dd-post-carousel/reviews/)

## 贡献者

 *   [ thehowarde ](https://profiles.wordpress.org/thehowarde/)

## 支持

有话要说吗？是否需要帮助？

 [查看支持论坛](https://wordpress.org/support/plugin/dd-post-carousel/)

## 捐助

您愿意支持这个插件的发展吗?

 [ 捐助此插件 ](https://www.duckdiverllc.com)