Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter soushiken

    (@soushiken)

    Nevermind, figured it out. Apparently, having “Edit” only enabled for the custom post type and disabled for “Posts” in general prevents listing them, unless “Create” is enabled for the custom post type. That’s weird and doesn’t really make sense, but as soon as “Edit” is checked for “Posts” and the custom post type, users can list and edit their own posts, but not submit new ones.

    Thread Starter soushiken

    (@soushiken)

    For anyone who needs a quick hack for the shortcode regarding this, in includes/views/asl.shortcode.php, locate the following line:
    foreach ($style['selected-showcustomtypes'] as $k => $v) {

    and insert the following filter before this line:
    $style['customtypes'] = apply_filters('asl_filter_post_types', $style['customtypes']);

    Then, in whatever page you need the shortcode filter, just call:

    function search_filter_cpts($list) {
       return ["your-desired-post-type"];
    }
    add_filter('asl_filter_post_types', 'search_filter_cpts');
    echo do_shortcode('[wpdreams_ajaxsearchlite]');

    and replace your-desired-post-type with whatever you want to pre-select here.

    Hello,

    is it also possible to un/select CPTs depending on the page? If I have archive pages for multiple CPTs (e.g., post types for fruits, vegetables) and on the archive page for fruits I want to only have fruits selected while for the vegetables archive, I only want to search through vegetables by default.

    Thanks in advance!

Viewing 3 replies - 1 through 3 (of 3 total)