• Resolved leelnj

    (@leelnj)


    Hi. I was wondering if your plugin or a paid version of it allowed multiple custom post type posts to be show on one slider. I run a news website and have multiple custom post types to seperate my news articles. I want to show a latest new widget showing news posts from these custom post types. Currently it only allows me to select 1 custom post type. Thanks in adavnce

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author thehowarde

    (@thehowarde)

    HI @leelnj

    You could (using the existing version) – filter the query arguments.

    https://wordpress.org/plugins/dd-post-carousel/#can%20i%20filter%20the%20query%20arguments%3F

    Thread Starter leelnj

    (@leelnj)

    Hi. Thanks for that but if possible could you help further please
    I have three custom post types. News, sport and lifestyle. How will i select those in the filter query function below and once i enter the query what post type will i select in the backend

    <?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;
    }
    }

    Plugin Author thehowarde

    (@thehowarde)

    Using standard WP_Query arguments.

    'post_type' => array('news', 'sport', lifestyle')

    Thread Starter leelnj

    (@leelnj)

    Hi sorry to bother you again. I have entered the post types slugs according to what i entered in custom post type ui. I have changed the carousel id number. It is not working. Is there anything you can see which im doing wrong. thanks in advance.

    add_filter(‘dd_carousel_filter_query_args’, ‘filter_carousel’, 10, 2);
    function filter_carousel($args, $carouselID){
    if ($carouselID == 161){
    $args = array(
    ‘post_type’ => array( ‘reveals’, ‘refresh’, ‘retreat’, ‘Reauses’ ),
    ‘meta_query’ => array(
    ‘relation’ => ‘AND’,
    array(
    ‘key’ => ‘_chosen_store’,
    ‘value’ => ‘1’,
    ‘compare’ => ‘>=’,
    ‘type’ => ‘NUMERIC’,
    ),
    ),
    );
    return $args;
    }
    }

    Plugin Author thehowarde

    (@thehowarde)

    Well if you don’t need the meta query… take it out.

    You could try using this to generate your query args: https://generatewp.com/wp_query/

    Plugin Author thehowarde

    (@thehowarde)

    Since there are no additional questions, I’m marking this as resolved.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘multiple custom post types in slider’ is closed to new replies.